Alexey
https://ecological_problems.academic.ru/313/%D0%9E%D0%B1%D1%89%D0%B8%D0%B9_%D1%81%D0%BB%D1%83%D1%87%D0%B0%D0%B9
сорян тогда, для меня «в общем случае» = forall, да и в математике вроде такой же смысл вкладывают, когда говорят «в общем случае это утвержение неверно»
Маjко
=> @rust_offtopic
Willy
попробуй sample: &[()]
Пробовал, нет
Dmytro
Пробовал, нет
а что реализует трейт Sample?
Dmytro
ну попробуй их)
Pavel
f32, u16, i16
опенсорс?
Willy
Willy
опенсорс?
Что опенсорс?
Willy
проект
Какой именно то?
Pavel
Какой именно то?
в котором у тебя f32, u16 и i16 реализуют Sample, очевидно
Pavel
А, это cpal
спасибо
Willy
подходящий укажи
Спасибо, да решено уже :)
Berkus
Спасибо, да решено уже :)
у меня телега решила не подгружать остаток дискуссии
вафля
а как &T превратить в &[T;1] ?
Если тебе подойдёт &[T], то можешь заюзать from_ref
вафля
(а если всё же очень нужен именно массив, то есть arraylib::ArrayExt::ref_cast 🌚)
Matwey
господа
Matwey
а почему rustfmt только пд найтли работает?
kitsu
Мб он у тебя не установлен на стейбле просто
Hirrolot
Или опции найтли-онли
Ivan
а как &T превратить в &[T;1] ?
std::slice::from_ref(&x).try_into().unwrap();
Ivan
(ну и естественно .try_into() работает только для массивов размером до 32 😅)
Ivan
и nightly к тому же?
нет, на stable работает
Ivan
Говорят, с 1.34.0: https://doc.rust-lang.org/src/core/array/mod.rs.html#137-147
Alexey
TryFrom/TryInto уже в стейбле? чет я отстал от жизни
Ivan
Год уже как? https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html
Alexey
Год уже как? https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html
действительно, видимо на стейбле не пытался использовать, все на найтли сижу, сказывается видать
mental
А можно как-то нормально соединить байты? То есть не аллоцировать, а потом перезаписывать, а сразу создавать один массив
Денис
А можно как-то нормально соединить байты? То есть не аллоцировать, а потом перезаписывать, а сразу создавать один массив
тоесть вы хотите соеденить два массива в один и при этом константно? и что за массивы то?
mental
тоесть вы хотите соеденить два массива в один и при этом константно? и что за массивы то?
Не, я хочу константную часть и u32 положить в один массив. Без лишних аллокаций и реврайтов Хотя, учитывая то, что я хочу преобразовать u32 в LittleEndian, без перезаписи массива не обойтись
mental
Так, ну по-видимому для удобной склейки мне понадобится smallvec. Эх, придется тянуть
Sergey
@ozkriff оживил таки this week in rust
Sergey
Каждый час будет чекать новости и как появится что-то выложит https://github.com/sergeysova/this_week_in_rust.rs
Денис
Так, ну по-видимому для удобной склейки мне понадобится smallvec. Эх, придется тянуть
я посмотрел этот LittleEndian, у него нету ни const, ни каких-либо нужных методов чтобы можно было провернуть по моей схеме)
red75prime
я посмотрел этот LittleEndian, у него нету ни const, ни каких-либо нужных методов чтобы можно было провернуть по моей схеме)
А челенж посчитать и сразу в массив прописать? Если нужен const, то он известен на стадии компиляции-же
kitsu
https://stackoverflow.blog/2020/05/27/2020-stack-overflow-developer-survey-results/ угадайте кто
red75prime
БУ
Adv0cat
Dmytro
БУ
о, это питон?
Денис
о, это питон?
оффтоп, но походу это компилируемый питон:)))
Matwey
Господа, а теперь минутка смеха. Я, оказывается, контрибьютер в rust: https://github.com/rust-lang/rust/pull/37482
Matwey
Случайно нашел
Null
This week in Rust #340 — 27 may 2020 https://this-week-in-rust.org/blog/2020/05/27/this-week-in-rust-340/
Null
Updates from core update to LLVM 10 rust-lang/rust/pull/67759 llvm: expose tiny code model to users rust-lang/rust/pull/72397 enable ARM TME (Transactional Memory Extensions) rust-lang/rust/pull/72438 implement new asm! syntax from RFC #2850 rust-lang/rust/pull/69171 always generated object code for #![no_builtins] rust-lang/rust/pull/72325 break tokens before checking if they are 'probably equal' rust-lang/rust/pull/72306 emit a better diagnostic when function actually has a 'self' parameter rust-lang/rust/pull/72308 stabilize fn-like proc macros in expression, pattern and statement positions rust-lang/rust/pull/68717 use once_cell crate instead of custom data structure rust-lang/rust/pull/72256 simple NRVO rust-lang/rust/pull/72205 remove ReScope rust-lang/rust/pull/72362 exhaustively check ty::Kind during structural match checking rust-lang/rust/pull/72153 move borrow-of-packed-field unsafety check out of loop rust-lang/rust/pull/72269 fix InlineAsmOperand expresions being visited twice during liveness checking rust-lang/rust/pull/72537 chalk: cleanup crate structure and add features for SLG/recursive solvers rust-lang/chalk/pull/459 check non-Send/Sync upvars captured by generator rust-lang/rust/pull/71923 support coercion between FnDef and arg-less closure and vice versa rust-lang/rust/pull/71599 more lazy normalization of constants rust-lang/rust/pull/71973 miri: prepare Dlsym system for dynamic symbols on Windows rust-lang/miri/pull/1424 use T's discriminant type in mem::Discriminant<T> instead of u64 rust-lang/rust/pull/70705 fix discriminant type in generator transform rust-lang/rust/pull/72502 impl From<Cow> for Box, Rc, and Arc rust-lang/rust/pull/71447 another attempt to reduce size_of<HashMap> rust-lang/hashbrown/pull/159 set initial non-empty Vec size to 4 instead of 1 rust-lang/rust/pull/72227 make std::char functions and constants associated to char rust-lang/rust/pull/71854 stabilize saturating_abs and saturating_neg rust-lang/rust/pull/71886 add len and slice_from_raw_parts to NonNull<[T]> rust-lang/rust/pull/71940 add fast-path optimization for Ipv4Addr::fmt rust-lang/rust/pull/72399 impl Ord for proc_macro::LineColumn rust-lang/rust/pull/72446 cargo: try installing exact versions before updating rust-lang/cargo/pull/8022 cargo: automatically update patch, and provide better errors if an update is not possible rust-lang/cargo/pull/8248 cargo: add option to strip binaries rust-lang/cargo/pull/8246 rustfmt: merge configs from parent directories rust-lang/rustfmt/pull/4179 rustfmt: umprove error message when module resolution failed rust-lang/rustfmt/pull/4198 rustfmt: parse comma-separated branches in macro definitions rust-lang/rustfmt/pull/4173
Null
News Compiling Rust binaries for Windows 98 SE and more: a journey seri.tools Zero To Production #0: Foreword www.lpalmieri.com Some Extensive Projects Working with Rust blog.knoldus.com Writing Python inside your Rust code — Part 4 blog.m-ou.se Drawing SVG Graphics with Rust cetra3.github.io Designing the Rust Unleash API Client medium.com/cognite Conway's Game of Life on the NES in Rust gridbugs.org How to organize your Rust tests blog.logrocket.com Just: How I Organize Large Rust Programs rodarmor.com Integrating Qt events into Actix and Rust www.rubdos.be Actix-Web in Docker: How to build small and secure images dev.to Angular, Rust, WebAssembly, Node.js, Serverless, and... the NEW Azure Static Web Apps! dev.to The Chromium project finds that around 70% of our serious security bugs are memory safety problems www.chromium.org Integration of AV-Metrics Into rav1e, the AV1 Encoder dev.to Oxidizing the technical interview blog.mgattozzi.dev Porting K-D Forests to Rust tavianator.com Rust Macro Rules in Practice dev.to Rust: Dropping heavy things in another thread can make your code 10000 times faster abramov.io Rust's Runtime blog.mgattozzi.dev [audio] Tech Except!ons: What Microsoft has to do with Rust? With Ryan Levick anchor.fm [video] [Russian] Rust: Not as hard as you think - Meta/conf: Backend Meetup 2020 www.youtube.com [video] 3 Part Video for Beginners to Rust Programming on Iteration tim.mcnamara.nz [video] Bringing WebAssembly outside the web with WASI by Lin Clark www.youtube.com [video] Microsoft's Safe Systems Programming Languages Effort mybuild.microsoft.com [video] Rust, WebAssembly, and the future of Serverless by Steve Klabnik www.youtube.com
Null
Crate of the week: cargo-asm This week's crate is cargo-asm, a cargo subcommand to show the resulting assembly of a function. Useful for performance work.
Sergey
Ого. Прям во время починил
Sergey
github.com/pretzelhammer/rust-blog/blob/master/posts/common-rust-lifetime-misconceptions.md
mental
А есть какой-то стандартный способ читать последовательные си строки с помощью курсора?
Ю ли я? 🤔
Тут можно глупые вопросы задавать, или есть канал rust-beginners?
Ю ли я? 🤔
Как создать хэшмапу из слайса пар ключ-значение? (кроме как пробежаться и заинсертить)
Ю ли я? 🤔
fn new(mappings: &[(KeyCode, T)]) -> InputMapper<T> { let mapper: HashMap::<KeyCode, T> = mappings.into_iter().collect(); Не выходит: help: the trait std::iter::FromIterator<&(KeyCode, T)> is not implemented for std::collections::HashMap<KeyCode, T>
Anonymous
Они у тебя по референсу
Ю ли я? 🤔
Угу, но они по идее Copy
Anonymous
Тогда есть метод .copied()
Anonymous
У итератора. Он позволяет сделать owned-версию
Anonymous
https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.copied
mental
Угу, но они по идее Copy
А ты уверен, что нужна копия?
Ю ли я? 🤔
Я вообще полагаю, что new-у будет передаваться массив по месту и можно отдавать его на съедение
Ю ли я? 🤔
Но если нет?
Anonymous
Anonymous
Ты можешь принимать I: IntoIterator<(KeyCode, T)> и оставить клиенту выбирать, как он хочет это обеспечить
Anonymous
Тогда, например, вектор можно будет передать «как есть», а слайс скопировать
Ю ли я? 🤔
А вот это мысль, спасибо.
Ю ли я? 🤔
Моему типу, для которого new, принимающий этот набор пар