!BHcierreUuwCMxVqOf:matrix.org

Rust Embedded

725 Members
Welcome to the Rust Embedded chat room! | Discuss, coordinate, help: https://github.com/rust-embedded/wg | Code of conduct: https://www.rust-lang.org/conduct.html | Temporary bridge running to #rust-embedded on libera.chat IRC | Public logs: https://libera.irclog.whitequark.org/rust-embedded | Old public logs: https://freenode.logbot.info/rust-embedded/76 Servers

Load older messages


SenderMessageTime
27 Jan 2022
@adamgreig:matrix.orgadamgreigbut in your http case, you'd perhaps be putting non-copy Ts into the Vec<T>, so it wouldn't be copy - you choose to make the HttpResponse not Copy00:22:03
@adamgreig:matrix.orgadamgreigthe vec would only be Copy if it contained Copy items, so that's the level at which ownership can be tracked00:22:38
@adamgreig:matrix.orgadamgreigfor example, stdlib impls Copy for [T; N] where T: Copy, which is quite similar to the heapless::Vec case00:23:36
@irc_libera_cr1901:psion.agg.iocr1901 Amanieu: Because everything to inline asm is Copy, that means I can safely change this function to use lateout? https://github.com/cr1901/msp430-atomic/blob/new-asm/src/lib.rs#L638-L642 00:30:05
@irc_libera_cr1901:psion.agg.iocr1901i.e. the same register can be used for dst and out, even tho the fn sig said "* const Self"?00:30:30
@dirbaio:matrix.orgdirbaioVec<u8, N> is dumb data, and dumb data should be Copy if it can00:50:25
@dirbaio:matrix.orgdirbaio if you want ownership semantics you should wrap the Vec in a Response non-Copy struct 00:50:52
@dirbaio:matrix.orgdirbaio even without Copy, Vec is a really bad way of tracking ownership of stuff, because you can .clone() it :P 00:53:18
@adamgreig:matrix.orgadamgreigonly if T:Clone :P00:54:06
@adamgreig:matrix.orgadamgreigbut yea, wrapping the vec in a newtype that's not Copy is the way to go to control ownership semantics00:54:19
@dirbaio:matrix.orgdirbaioyeah, but same goes for Copy00:54:19
@adamgreig:matrix.orgadamgreig(or putting non-Copy items inside the Vec if that happens to make more sense)00:54:27
@dirbaio:matrix.orgdirbaioall Clone types should also be Copy if they can00:55:35
@dirbaio:matrix.orgdirbaio
error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor
   --> src/vec.rs:845:1
    |
845 | impl<T, const N: usize> Copy for Vec<T, N> where T: Copy {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Copy not allowed on types with destructors
01:02:01
@dirbaio:matrix.orgdirbaioohhmm whoops01:02:05
@adamgreig:matrix.orgadamgreigI guess that's why not01:03:50
@dirbaio:matrix.orgdirbaioyeah, RIP01:03:56
@dirbaio:matrix.orgdirbaio and you can't do stuff like impl Drop for Vec<T, N> where T: Drop, or impl Drop for Vec<T, N> where T: !Copy 01:04:25
@dirbaio:matrix.orgdirbaioshame shame shame01:04:29
@adamgreig:matrix.orgadamgreigdid docs.rs get a cool new theme for new crates or something? the heapless page looks great01:05:32
@dirbaio:matrix.orgdirbaioscreenshot-2022-01-27_02-15-20.png
Download screenshot-2022-01-27_02-15-20.png
01:15:29
@dirbaio:matrix.orgdirbaiosorted_li nked_list 👌01:15:52
@adamgreig:matrix.orgadamgreigugh, i keep bumping in to f32 just mysteriously not having abs() on thumbv7 targets01:28:27
@adamgreig:matrix.orgadamgreigi can see not having trig functions and stuff, but abs isn't transcendental 🙈01:28:57
@adamgreig:matrix.orgadamgreig5 years ago: https://github.com/adamgreig/labrador-ldpc/blob/master/src/decoder.rs#L19-L2901:30:14
@adamgreig:matrix.orgadamgreigrust now has f32::to_bits() and from_bits() so I guess I could do a bit better...01:31:59
@adamgreig:matrix.orgadamgreig f32::from_bits(x.to_bits() & 0x7FFF_FFFF) nice 01:34:31
@adamgreig:matrix.orgadamgreig compiles to bic r0, r0, #-2147483648, I'll take it 01:36:02
@irc_libera_starblue1:psion.agg.iostarblue1 left the room.02:57:51
@irc_libera_starblue1:psion.agg.iostarblue1 joined the room.02:59:18

There are no newer messages yet.


Back to Room List