Trait container_broadcast::broadcast::Broadcastable [−][src]
The main trait of this crate. Somehat like iterator, is effectively a lazy multidimensional array-like object instead of a lazy sequence. You can map over functions, zip them, take cartesian products, etc etc in a way that does not erase structure, and produces another object with random access indexing unlike iterators.
Associated Types
Loading content...Required methods
fn bget(&self, index: [usize; DIM]) -> Option<Self::Element>
[src]
This should return none iff the default inbounds method returns false.
Provided methods
fn mod_bget(&self, index: [isize; DIM]) -> Self::Element
[src]
Takes indices modulo size. Useful for periodic shifts of indices.
fn feedto(
&self,
receiver: &mut impl BroadcastReceiver<DIM, Element = Self::Element>
) -> Option<()>
[src]
&self,
receiver: &mut impl BroadcastReceiver<DIM, Element = Self::Element>
) -> Option<()>
Writes the contents of the Broadcastable to a receiver, such as an actual (multidimensional) array.
fn lazy_updim<const NEWDIM: usize>(
&self,
size: [usize; NEWDIM]
) -> LazyUpdim<'_, Self, DIM, NEWDIM>
[src]
&self,
size: [usize; NEWDIM]
) -> LazyUpdim<'_, Self, DIM, NEWDIM>
Returns an object with the provided size. If NEWDIM > Self::DIM, the additional indices are ignored. All entries of size input must be either equal to the size of input, except for entries where the original size was 1.
fn reshaped<const NEWDIM: usize>(
self,
size: [usize; NEWDIM]
) -> ReShaped<Self, NEWDIM, DIM>
[src]
self,
size: [usize; NEWDIM]
) -> ReShaped<Self, NEWDIM, DIM>
The main way to create multidimensional arrays with this crate, but can resize any broadcastable. Resized broadcastables must have the same number of elements as the old one. Preserves iteration order. Reshapes a broadcastable by linearizing and delinearizing indices.
fn mapindex<F: Fn([usize; M], [usize; M]) -> [usize; DIM], const M: usize>(
&self,
indexclosure: F,
sizeclosure: impl Fn([usize; DIM]) -> [usize; M]
) -> MapIndex<'_, Self, F, DIM, M>
[src]
&self,
indexclosure: F,
sizeclosure: impl Fn([usize; DIM]) -> [usize; M]
) -> MapIndex<'_, Self, F, DIM, M>
Provides a more flexible but less safe way to reshape a broadcastable. Useful for slicing and dicing arrays and broadcastables, taking diagonals, etc etc.
fn offset_mod(&self, offset: [isize; DIM]) -> OffsetBroadcast<'_, Self, DIM>
[src]
Returns a new broadcast which is periodically offset by offset.
fn bmap<T, F: Fn(Self::Element) -> T>(
&self,
foo: F
) -> BMap<'_, T, Self, F, DIM>
[src]
&self,
foo: F
) -> BMap<'_, T, Self, F, DIM>
Elements of returned broadcastable are the output of the provided closure, applied to the input broadcastable.
fn bcloned(self) -> BCloned<Self, DIM>
[src]
For inputs whose elements are references, clones them.
fn broadcast2<'a, 'b, T: Broadcastable<N>, const N: usize>(
&'a self,
foo: &'b T
) -> Broadcast2<LazyUpdim<'a, Self, DIM, DIM>, LazyUpdim<'b, T, N, DIM>, DIM>
[src]
&'a self,
foo: &'b T
) -> Broadcast2<LazyUpdim<'a, Self, DIM, DIM>, LazyUpdim<'b, T, N, DIM>, DIM>
Unique operation not found in Iterators. If the dimensions of the two broadcastable, zips them. If not, will lazy_updim all inputs to the same size. As such, can also provide cartesian or tensor products depending on input. NEW CONSTRAINT IN v0.0.6: N must be smaller than DIM, CHECKED AT RUNTIME. The argument with higher Self::DIM must be first. This is partly to eliminate use of nightly features, and because the Rust type system often cannot prove equality.
fn bc_iter(&self) -> BroadcastIterator<'_, Self, DIM>ⓘNotable traits for BroadcastIterator<'a, T, DIM>
impl<'a, T: Broadcastable<DIM>, const DIM: usize> Iterator for BroadcastIterator<'a, T, DIM> type Item = T::Element;
[src]
Notable traits for BroadcastIterator<'a, T, DIM>
impl<'a, T: Broadcastable<DIM>, const DIM: usize> Iterator for BroadcastIterator<'a, T, DIM> type Item = T::Element;
Takes a broadcastable and returns an iterator over its elements.