pub trait SliceMoveSourceCollection<T>: SliceSourceCollection<T>{
// Required method
fn move_all_elements<F>(self, f: F)
where Self: Sized,
F: FnMut(<T as SliceLike>::Element);
}
Expand description
Subtrait of SliceSourceCollection
for taking ownership of the contents
of a collection of slice sources.
Required Methods§
Sourcefn move_all_elements<F>(self, f: F)
fn move_all_elements<F>(self, f: F)
Calls a closure for each item in all SliceSource
objects of this
collection in sequence, consuming the collection.
§Examples
use scratchpad::SliceMoveSourceCollection;
let collection = ([1, 2, 3], [4], [5, 6]);
let mut out = Vec::new();
collection.move_all_elements(|x| out.push(x * 2));
assert_eq!(*out, [2, 4, 6, 8, 10, 12]);
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.