FunctionalSequence | Defines functional programming methods for generic sequences
diff --git a/generic_array/functional/trait.FunctionalSequence.html b/generic_array/functional/trait.FunctionalSequence.html
index ded8befb..c5eec625 100644
--- a/generic_array/functional/trait.FunctionalSequence.html
+++ b/generic_array/functional/trait.FunctionalSequence.html
@@ -1,7 +1,7 @@
generic_array::functional::FunctionalSequence - Rust
pub unsafe trait FunctionalSequence<T>: GenericSequence<T> {
fn map<U, F>(self, f: F) -> MappedSequence<Self, T, U> where Self: MappedGenericSequence<T, U>, Self::Length: ArrayLength<U>, F: FnMut(Self::Item) -> U,
{ ... }
fn zip<B, Rhs, U, F>(self, rhs: Rhs, f: F) -> MappedSequence<Self, T, U> where Self: MappedGenericSequence<T, U>, Rhs: MappedGenericSequence<B, U, Mapped = MappedSequence<Self, T, U>>, Self::Length: ArrayLength<B> + ArrayLength<U>, Rhs: GenericSequence<B, Length = Self::Length>, F: FnMut(Self::Item, Rhs::Item) -> U,
@@ -18,4 +18,4 @@ initializing a new GenericSequence with the result of the zipped ma
will be dropped, AND any unused elements in the source sequences will also be dropped.
fn fold<U, F>(self, init: U, f: F) -> U where F: FnMut(U, Self::Item) -> U,
Folds (or reduces) a sequence of data into a single value.
If the fold function panics, any unused elements will be dropped.
- Loading content...impl<'a, T, S: GenericSequence<T>> FunctionalSequence<T> for &'a mut S where &'a mut S: GenericSequence<T>, [src]
impl<T, N> FunctionalSequence<T> for GenericArray<T, N> where N: ArrayLength<T>, Self: GenericSequence<T, Item = T, Length = N>, [src]
fn fold<U, F>(self, init: U, f: F) -> U where F: FnMut(U, T) -> U, [src]
Loading content...
\ No newline at end of file
+Loading content...impl<'a, T, S: GenericSequence<T>> FunctionalSequence<T> for &'a mut S where &'a mut S: GenericSequence<T>, [src]
impl<T, N> FunctionalSequence<T> for GenericArray<T, N> where N: ArrayLength<T>, Self: GenericSequence<T, Item = T, Length = N>, [src]
fn fold<U, F>(self, init: U, f: F) -> U where F: FnMut(U, T) -> U, [src]
Loading content...
\ No newline at end of file
diff --git a/generic_array/functional/trait.MappedGenericSequence.html b/generic_array/functional/trait.MappedGenericSequence.html
index 05262999..a8f011c4 100644
--- a/generic_array/functional/trait.MappedGenericSequence.html
+++ b/generic_array/functional/trait.MappedGenericSequence.html
@@ -1,9 +1,9 @@
generic_array::functional::MappedGenericSequence - Rust
Defines the relationship between one generic sequence and another,
for operations such as map and zip .
Loading content...Loading content...
\ No newline at end of file
+Loading content...Loading content...
\ No newline at end of file
diff --git a/generic_array/functional/type.MappedSequence.html b/generic_array/functional/type.MappedSequence.html
index 277a6a36..cfaa9207 100644
--- a/generic_array/functional/type.MappedSequence.html
+++ b/generic_array/functional/type.MappedSequence.html
@@ -1,5 +1,5 @@
generic_array::functional::MappedSequence - Rust
type MappedSequence<S, T, U> = <<S as MappedGenericSequence<T, U>>::Mapped as GenericSequence<U>>::Sequence; Accessor type for a mapped generic sequence
+ type MappedSequence<S, T, U> = <<S as MappedGenericSequence<T, U>>::Mapped as GenericSequence<U>>::Sequence; Accessor type for a mapped generic sequence
\ No newline at end of file
diff --git a/generic_array/index.html b/generic_array/index.html
index ac53ec68..32596fa1 100644
--- a/generic_array/index.html
+++ b/generic_array/index.html
@@ -1,31 +1,53 @@
generic_array - Rust
-This crate implements a structure that can be used as a generic array type.use
+ This crate implements a structure that can be used as a generic array type.
Core Rust array types [T; N] can't be used generically with
respect to N , so for example this:
- struct Foo<T, N> {
- data: [T; N]
-}
-
+
+
+struct Foo<T, N> {
+ data: [T; N]
+}
won't work.
generic-array exports a GenericArray<T,N> type, which lets
the above be implemented as:
+use generic_array::{ArrayLength, GenericArray};
+
struct Foo<T, N: ArrayLength<T>> {
data: GenericArray<T,N>
}
The ArrayLength<T> trait is implemented by default for
unsigned integer types from
-typenum.
+ typenum:
+
+
+use generic_array::typenum::U5;
+
+struct Foo<N: ArrayLength<i32>> {
+ data: GenericArray<i32, N>
+}
+
+let foo = Foo::<U5>{data: GenericArray::default()};
+ For example, GenericArray<T, U5> would work almost like [T; 5] :
+
+
+use generic_array::typenum::U5;
+
+struct Foo<T, N: ArrayLength<T>> {
+ data: GenericArray<T, N>
+}
+
+let foo = Foo::<i32, U5>{data: GenericArray::default()};
For ease of use, an arr! macro is provided - example below:
let array = arr![u32; 1, 2, 3];
assert_eq!(array[2], 3);
-
+
arr | Implementation for arr! macro.
| functional | Functional programming with generic sequences
| iter | GenericArray iterator implementation.
diff --git a/generic_array/iter/index.html b/generic_array/iter/index.html
index ace0a183..7a7fb4d4 100644
--- a/generic_array/iter/index.html
+++ b/generic_array/iter/index.html
@@ -1,7 +1,7 @@
generic_array::iter - Rust
GenericArray iterator implementation.
+ GenericArray iterator implementation.
\ No newline at end of file
diff --git a/generic_array/iter/struct.GenericArrayIter.html b/generic_array/iter/struct.GenericArrayIter.html
index dc6b526f..e2454d3a 100644
--- a/generic_array/iter/struct.GenericArrayIter.html
+++ b/generic_array/iter/struct.GenericArrayIter.html
@@ -1,30 +1,31 @@
generic_array::iter::GenericArrayIter - Rust
-pub struct GenericArrayIter<T, N: ArrayLength<T>> { /* fields omitted */ } An iterator that moves out of a GenericArray
- Returns the remaining items of this iterator as a slice
- Returns the remaining items of this iterator as a mutable slice
- Returns a copy of the value. Read more
+ pub struct GenericArrayIter<T, N: ArrayLength<T>> { /* fields omitted */ } An iterator that moves out of a GenericArray
+ Returns the remaining items of this iterator as a slice
+ Returns the remaining items of this iterator as a mutable slice
+ Formats the value using the given formatter. Read more
- Removes and returns an element from the end of the iterator. Read more
+ Formats the value using the given formatter. Read more
+ Removes and returns an element from the end of the iterator. Read more
+ fn rfold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B, [src]
An iterator method that reduces the iterator's elements to a single,
+final value, starting from the back. Read more
🔬 This is a nightly-only experimental API. (iter_advance_by )recently added
Advances the iterator from the back by n elements. Read more
Returns the n th element from the end of the iterator. Read more
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R where F: FnMut(B, Self::Item) -> R, R: Try<Ok = B>, 1.27.0[src]
fn rfold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B, 1.27.0[src]
An iterator method that reduces the iterator's elements to a single,
-final value, starting from the back. Read more
fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool, 1.27.0[src]
Searches for an element of an iterator from the back that satisfies a predicate. Read more
- Executes the destructor for this type. Read more
- Executes the destructor for this type. Read more
+ fn len(&self) -> usize [src]
Returns the exact length of the iterator. Read more
🔬 This is a nightly-only experimental API. (exact_size_is_empty ) Returns true if the iterator is empty. Read more
- type Item = T
The type of the elements being iterated over.
- Advances the iterator and returns the next value. Read more
- Returns the bounds on the remaining length of the iterator. Read more
- Consumes the iterator, counting the number of iterations and returning it. Read more
- fn nth(&mut self, n: usize) -> Option<T> [src]
Returns the n th element of the iterator. Read more
- Consumes the iterator, returning the last element. Read more
+ type Item = T
The type of the elements being iterated over.
+ Advances the iterator and returns the next value. Read more
+ fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B, [src]
An iterator method that applies a function, producing a single, final value. Read more
+ Returns the bounds on the remaining length of the iterator. Read more
+ Consumes the iterator, counting the number of iterations and returning it. Read more
+ fn nth(&mut self, n: usize) -> Option<T> [src]
Returns the n th element of the iterator. Read more
+ Consumes the iterator, returning the last element. Read more
🔬 This is a nightly-only experimental API. (iter_advance_by )recently added
Advances the iterator by n elements. Read more
fn step_by(self, step: usize) -> StepBy<Self> 1.28.0[src]
Creates an iterator starting at the same point, but stepping by
@@ -68,7 +69,6 @@ such that all those that return true precede all those that return
successfully, producing a single, final value. Read more
fn try_for_each<F, R>(&mut self, f: F) -> R where F: FnMut(Self::Item) -> R, R: Try<Ok = ()>, 1.27.0[src]
An iterator method that applies a fallible function to each item in the
iterator, stopping at the first error and returning that error. Read more
- fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B, 1.0.0[src]
An iterator method that applies a function, producing a single, final value. Read more
🔬 This is a nightly-only experimental API. (iterator_fold_self ) The same as fold() , but uses the first element in the
iterator as the initial value, folding every subsequent element into it.
If the iterator is empty, return None ; otherwise, return the result
diff --git a/generic_array/macro.arr.html b/generic_array/macro.arr.html
index 51fc3645..8265c3ea 100644
--- a/generic_array/macro.arr.html
+++ b/generic_array/macro.arr.html
@@ -1,7 +1,7 @@
generic_array::arr - Rust
macro_rules! arr {
($T:ty; $(,)*) => { ... };
($T:ty; $($x:expr),* $(,)*) => { ... };
diff --git a/generic_array/sequence/index.html b/generic_array/sequence/index.html
index 6a7e1028..d1ab2611 100644
--- a/generic_array/sequence/index.html
+++ b/generic_array/sequence/index.html
@@ -1,7 +1,7 @@
generic_array::sequence - Rust
Useful traits for manipulating sequences of data stored in GenericArray s
+ Useful traits for manipulating sequences of data stored in GenericArray s
Concat | Defines GenericSequence s which can be joined together, forming a larger array.
| GenericSequence | Defines some sequence with an associated length and iteration capabilities.
diff --git a/generic_array/sequence/trait.Concat.html b/generic_array/sequence/trait.Concat.html
index 2a1fd3ef..c3b385e9 100644
--- a/generic_array/sequence/trait.Concat.html
+++ b/generic_array/sequence/trait.Concat.html
@@ -1,7 +1,7 @@
generic_array::sequence::Concat - Rust
Sequence to be concatenated with self
Resulting sequence formed by the concatenation.
Loading content...fn concat(self, rest: Self::Rest) -> Self::Output
Concatenate, or join, two sequences.
- Loading content...Loading content...
\ No newline at end of file
+Loading content...Loading content...
\ No newline at end of file
diff --git a/generic_array/sequence/trait.GenericSequence.html b/generic_array/sequence/trait.GenericSequence.html
index 2a7f5e58..59017c61 100644
--- a/generic_array/sequence/trait.GenericSequence.html
+++ b/generic_array/sequence/trait.GenericSequence.html
@@ -1,7 +1,7 @@
generic_array::sequence::GenericSequence - Rust
Loading content...fn generate<F>(f: F) -> Self::Sequence where F: FnMut(usize) -> T,
Initializes a new sequence instance using the given function.
If the generator function panics while initializing the sequence,
any already initialized elements will be dropped.
- Loading content...Loading content...
\ No newline at end of file
+Loading content...Loading content...
\ No newline at end of file
diff --git a/generic_array/sequence/trait.Lengthen.html b/generic_array/sequence/trait.Lengthen.html
index 2e0301be..19643234 100644
--- a/generic_array/sequence/trait.Lengthen.html
+++ b/generic_array/sequence/trait.Lengthen.html
@@ -1,7 +1,7 @@
generic_array::sequence::Lengthen - Rust
Loading content...fn append(self, last: T) -> Self::Longer
Returns a new array with the given element appended to the end of it.
Example:
-
+
let a = arr![i32; 1, 2, 3];
let b = a.append(4);
@@ -21,10 +21,10 @@ or prepending an element to it.
fn prepend(self, first: T) -> Self::Longer
Returns a new array with the given element prepended to the front of it.
Example:
-
+
let a = arr![i32; 1, 2, 3];
let b = a.prepend(4);
assert_eq!(b, arr![i32; 4, 1, 2, 3]);
- Loading content...Loading content...
\ No newline at end of file
+ Loading content...Loading content...
\ No newline at end of file
diff --git a/generic_array/sequence/trait.Shorten.html b/generic_array/sequence/trait.Shorten.html
index 7b11e658..7368fc95 100644
--- a/generic_array/sequence/trait.Shorten.html
+++ b/generic_array/sequence/trait.Shorten.html
@@ -1,7 +1,7 @@
generic_array::sequence::Shorten - Rust
Loading content...Returns a new array without the last element, and the last element.
Example:
-
+
let a = arr![i32; 1, 2, 3, 4];
let (init, last) = a.pop_back();
@@ -22,11 +22,11 @@ appending or prepending an element to it.
Returns a new array without the first element, and the first element.
Example:
-
+
let a = arr![i32; 1, 2, 3, 4];
let (head, tail) = a.pop_front();
assert_eq!(head, 1);
assert_eq!(tail, arr![i32; 2, 3, 4]);
- Loading content...Loading content...
\ No newline at end of file
+ Loading content...Loading content...
\ No newline at end of file
diff --git a/generic_array/sequence/trait.Split.html b/generic_array/sequence/trait.Split.html
index e3301dc6..452b0f3d 100644
--- a/generic_array/sequence/trait.Split.html
+++ b/generic_array/sequence/trait.Split.html
@@ -1,7 +1,7 @@
generic_array::sequence::Split - Rust
First part of the resulting split array
Second part of the resulting split array
Loading content...Splits an array at the given index, returning the separate parts of the array.
- Loading content...Loading content...
\ No newline at end of file
+ Loading content...Loading content... |
|
|