Struct sqlx::types::BitVec [−][src]
pub struct BitVec<B = u32> { /* fields omitted */ }
Expand description
The bitvector type.
Examples
use bit_vec::BitVec; let mut bv = BitVec::from_elem(10, false); // insert all primes less than 10 bv.set(2, true); bv.set(3, true); bv.set(5, true); bv.set(7, true); println!("{:?}", bv); println!("total bits set to true: {}", bv.iter().filter(|x| *x).count()); // flip all values in bitvector, producing non-primes less than 10 bv.negate(); println!("{:?}", bv); println!("total bits set to true: {}", bv.iter().filter(|x| *x).count()); // reset bitvector to empty bv.clear(); println!("{:?}", bv); println!("total bits set to true: {}", bv.iter().filter(|x| *x).count());
Implementations
impl BitVec<u32>
[src]
impl BitVec<u32>
[src]pub fn from_elem(nbits: usize, bit: bool) -> BitVec<u32>
[src]
pub fn from_elem(nbits: usize, bit: bool) -> BitVec<u32>
[src]Creates a BitVec
that holds nbits
elements, setting each element
to bit
.
Examples
use bit_vec::BitVec; let mut bv = BitVec::from_elem(10, false); assert_eq!(bv.len(), 10); for x in bv.iter() { assert_eq!(x, false); }
pub fn with_capacity(nbits: usize) -> BitVec<u32>
[src]
pub fn with_capacity(nbits: usize) -> BitVec<u32>
[src]Constructs a new, empty BitVec
with the specified capacity.
The bitvector will be able to hold at least capacity
bits without
reallocating. If capacity
is 0, it will not allocate.
It is important to note that this function does not specify the length of the returned bitvector, but only the capacity.
pub fn from_bytes(bytes: &[u8]) -> BitVec<u32>
[src]
pub fn from_bytes(bytes: &[u8]) -> BitVec<u32>
[src]Transforms a byte-vector into a BitVec
. Each byte becomes eight bits,
with the most significant bits of each byte coming first. Each
bit becomes true
if equal to 1 or false
if equal to 0.
Examples
use bit_vec::BitVec; let bv = BitVec::from_bytes(&[0b10100000, 0b00010010]); assert!(bv.eq_vec(&[true, false, true, false, false, false, false, false, false, false, false, true, false, false, true, false]));
pub fn from_fn<F>(len: usize, f: F) -> BitVec<u32> where
F: FnMut(usize) -> bool,
[src]
pub fn from_fn<F>(len: usize, f: F) -> BitVec<u32> where
F: FnMut(usize) -> bool,
[src]Creates a BitVec
of the specified length where the value at each index
is f(index)
.
Examples
use bit_vec::BitVec; let bv = BitVec::from_fn(5, |i| { i % 2 == 0 }); assert!(bv.eq_vec(&[true, false, true, false, true]));
impl<B> BitVec<B> where
B: BitBlock,
[src]
impl<B> BitVec<B> where
B: BitBlock,
[src]pub fn storage(&self) -> &[B]β
[src]
pub fn storage(&self) -> &[B]β
[src]Exposes the raw block storage of this BitVec
Only really intended for BitSet.
pub unsafe fn storage_mut(&mut self) -> &mut Vec<B, Global>β
[src]
pub unsafe fn storage_mut(&mut self) -> &mut Vec<B, Global>β
[src]Exposes the raw block storage of this BitVec
Can probably cause unsafety. Only really intended for BitSet.
pub fn get(&self, i: usize) -> Option<bool>
[src]
pub fn get(&self, i: usize) -> Option<bool>
[src]Retrieves the value at index i
, or None
if the index is out of bounds.
Examples
use bit_vec::BitVec; let bv = BitVec::from_bytes(&[0b01100000]); assert_eq!(bv.get(0), Some(false)); assert_eq!(bv.get(1), Some(true)); assert_eq!(bv.get(100), None); // Can also use array indexing assert_eq!(bv[1], true);
pub fn set_all(&mut self)
[src]
pub fn set_all(&mut self)
[src]Sets all bits to 1.
Examples
use bit_vec::BitVec; let before = 0b01100000; let after = 0b11111111; let mut bv = BitVec::from_bytes(&[before]); bv.set_all(); assert_eq!(bv, BitVec::from_bytes(&[after]));
pub fn negate(&mut self)
[src]
pub fn negate(&mut self)
[src]Flips all bits.
Examples
use bit_vec::BitVec; let before = 0b01100000; let after = 0b10011111; let mut bv = BitVec::from_bytes(&[before]); bv.negate(); assert_eq!(bv, BitVec::from_bytes(&[after]));
pub fn union(&mut self, other: &BitVec<B>) -> bool
[src]
π Deprecated since 0.7.0: Please use the βorβ function instead
pub fn union(&mut self, other: &BitVec<B>) -> bool
[src]Please use the βorβ function instead
Calculates the union of two bitvectors. This acts like the bitwise or
function.
Sets self
to the union of self
and other
. Both bitvectors must be
the same length. Returns true
if self
changed.
Panics
Panics if the bitvectors are of different lengths.
Examples
use bit_vec::BitVec; let a = 0b01100100; let b = 0b01011010; let res = 0b01111110; let mut a = BitVec::from_bytes(&[a]); let b = BitVec::from_bytes(&[b]); assert!(a.union(&b)); assert_eq!(a, BitVec::from_bytes(&[res]));
pub fn intersect(&mut self, other: &BitVec<B>) -> bool
[src]
π Deprecated since 0.7.0: Please use the βandβ function instead
pub fn intersect(&mut self, other: &BitVec<B>) -> bool
[src]Please use the βandβ function instead
Calculates the intersection of two bitvectors. This acts like the
bitwise and
function.
Sets self
to the intersection of self
and other
. Both bitvectors
must be the same length. Returns true
if self
changed.
Panics
Panics if the bitvectors are of different lengths.
Examples
use bit_vec::BitVec; let a = 0b01100100; let b = 0b01011010; let res = 0b01000000; let mut a = BitVec::from_bytes(&[a]); let b = BitVec::from_bytes(&[b]); assert!(a.intersect(&b)); assert_eq!(a, BitVec::from_bytes(&[res]));
pub fn or(&mut self, other: &BitVec<B>) -> bool
[src]
pub fn or(&mut self, other: &BitVec<B>) -> bool
[src]Calculates the bitwise or
of two bitvectors.
Sets self
to the union of self
and other
. Both bitvectors must be
the same length. Returns true
if self
changed.
Panics
Panics if the bitvectors are of different lengths.
Examples
use bit_vec::BitVec; let a = 0b01100100; let b = 0b01011010; let res = 0b01111110; let mut a = BitVec::from_bytes(&[a]); let b = BitVec::from_bytes(&[b]); assert!(a.or(&b)); assert_eq!(a, BitVec::from_bytes(&[res]));
pub fn and(&mut self, other: &BitVec<B>) -> bool
[src]
pub fn and(&mut self, other: &BitVec<B>) -> bool
[src]Calculates the bitwise and
of two bitvectors.
Sets self
to the intersection of self
and other
. Both bitvectors
must be the same length. Returns true
if self
changed.
Panics
Panics if the bitvectors are of different lengths.
Examples
use bit_vec::BitVec; let a = 0b01100100; let b = 0b01011010; let res = 0b01000000; let mut a = BitVec::from_bytes(&[a]); let b = BitVec::from_bytes(&[b]); assert!(a.and(&b)); assert_eq!(a, BitVec::from_bytes(&[res]));
pub fn difference(&mut self, other: &BitVec<B>) -> bool
[src]
pub fn difference(&mut self, other: &BitVec<B>) -> bool
[src]Calculates the difference between two bitvectors.
Sets each element of self
to the value of that element minus the
element of other
at the same index. Both bitvectors must be the same
length. Returns true
if self
changed.
Panics
Panics if the bitvectors are of different length.
Examples
use bit_vec::BitVec; let a = 0b01100100; let b = 0b01011010; let a_b = 0b00100100; // a - b let b_a = 0b00011010; // b - a let mut bva = BitVec::from_bytes(&[a]); let bvb = BitVec::from_bytes(&[b]); assert!(bva.difference(&bvb)); assert_eq!(bva, BitVec::from_bytes(&[a_b])); let bva = BitVec::from_bytes(&[a]); let mut bvb = BitVec::from_bytes(&[b]); assert!(bvb.difference(&bva)); assert_eq!(bvb, BitVec::from_bytes(&[b_a]));
pub fn xor(&mut self, other: &BitVec<B>) -> bool
[src]
pub fn xor(&mut self, other: &BitVec<B>) -> bool
[src]Calculates the xor of two bitvectors.
Sets self
to the xor of self
and other
. Both bitvectors must be
the same length. Returns true
if self
changed.
Panics
Panics if the bitvectors are of different length.
Examples
use bit_vec::BitVec; let a = 0b01100110; let b = 0b01010100; let res = 0b00110010; let mut a = BitVec::from_bytes(&[a]); let b = BitVec::from_bytes(&[b]); assert!(a.xor(&b)); assert_eq!(a, BitVec::from_bytes(&[res]));
pub fn nand(&mut self, other: &BitVec<B>) -> bool
[src]
pub fn nand(&mut self, other: &BitVec<B>) -> bool
[src]Calculates the nand of two bitvectors.
Sets self
to the nand of self
and other
. Both bitvectors must be
the same length. Returns true
if self
changed.
Panics
Panics if the bitvectors are of different length.
Examples
use bit_vec::BitVec; let a = 0b01100110; let b = 0b01010100; let res = 0b10111011; let mut a = BitVec::from_bytes(&[a]); let b = BitVec::from_bytes(&[b]); assert!(a.nand(&b)); assert_eq!(a, BitVec::from_bytes(&[res]));
pub fn nor(&mut self, other: &BitVec<B>) -> bool
[src]
pub fn nor(&mut self, other: &BitVec<B>) -> bool
[src]Calculates the nor of two bitvectors.
Sets self
to the nor of self
and other
. Both bitvectors must be
the same length. Returns true
if self
changed.
Panics
Panics if the bitvectors are of different length.
Examples
use bit_vec::BitVec; let a = 0b01100110; let b = 0b01010100; let res = 0b10001001; let mut a = BitVec::from_bytes(&[a]); let b = BitVec::from_bytes(&[b]); assert!(a.nor(&b)); assert_eq!(a, BitVec::from_bytes(&[res]));
pub fn xnor(&mut self, other: &BitVec<B>) -> bool
[src]
pub fn xnor(&mut self, other: &BitVec<B>) -> bool
[src]Calculates the xnor of two bitvectors.
Sets self
to the xnor of self
and other
. Both bitvectors must be
the same length. Returns true
if self
changed.
Panics
Panics if the bitvectors are of different length.
Examples
use bit_vec::BitVec; let a = 0b01100110; let b = 0b01010100; let res = 0b11001101; let mut a = BitVec::from_bytes(&[a]); let b = BitVec::from_bytes(&[b]); assert!(a.xnor(&b)); assert_eq!(a, BitVec::from_bytes(&[res]));
pub fn all(&self) -> bool
[src]
pub fn all(&self) -> bool
[src]Returns true
if all bits are 1.
Examples
use bit_vec::BitVec; let mut bv = BitVec::from_elem(5, true); assert_eq!(bv.all(), true); bv.set(1, false); assert_eq!(bv.all(), false);
pub fn iter(&self) -> Iter<'_, B>
[src]
pub fn iter(&self) -> Iter<'_, B>
[src]Returns an iterator over the elements of the vector in order.
Examples
use bit_vec::BitVec; let bv = BitVec::from_bytes(&[0b01110100, 0b10010010]); assert_eq!(bv.iter().filter(|x| *x).count(), 7);
pub fn append(&mut self, other: &mut BitVec<B>)
[src]
pub fn append(&mut self, other: &mut BitVec<B>)
[src]Moves all bits from other
into Self
, leaving other
empty.
Examples
use bit_vec::BitVec; let mut a = BitVec::from_bytes(&[0b10000000]); let mut b = BitVec::from_bytes(&[0b01100001]); a.append(&mut b); assert_eq!(a.len(), 16); assert_eq!(b.len(), 0); assert!(a.eq_vec(&[true, false, false, false, false, false, false, false, false, true, true, false, false, false, false, true]));
pub fn split_off(&mut self, at: usize) -> BitVec<B>
[src]
pub fn split_off(&mut self, at: usize) -> BitVec<B>
[src]Splits the BitVec
into two at the given bit,
retaining the first half in-place and returning the second one.
Panics
Panics if at
is out of bounds.
Examples
use bit_vec::BitVec; let mut a = BitVec::new(); a.push(true); a.push(false); a.push(false); a.push(true); let b = a.split_off(2); assert_eq!(a.len(), 2); assert_eq!(b.len(), 2); assert!(a.eq_vec(&[true, false])); assert!(b.eq_vec(&[false, true]));
pub fn none(&self) -> bool
[src]
pub fn none(&self) -> bool
[src]Returns true
if all bits are 0.
Examples
use bit_vec::BitVec; let mut bv = BitVec::from_elem(10, false); assert_eq!(bv.none(), true); bv.set(3, true); assert_eq!(bv.none(), false);
pub fn any(&self) -> bool
[src]
pub fn any(&self) -> bool
[src]Returns true
if any bit is 1.
Examples
use bit_vec::BitVec; let mut bv = BitVec::from_elem(10, false); assert_eq!(bv.any(), false); bv.set(3, true); assert_eq!(bv.any(), true);
pub fn to_bytes(&self) -> Vec<u8, Global>β
[src]
pub fn to_bytes(&self) -> Vec<u8, Global>β
[src]Organises the bits into bytes, such that the first bit in the
BitVec
becomes the high-order bit of the first byte. If the
size of the BitVec
is not a multiple of eight then trailing bits
will be filled-in with false
.
Examples
use bit_vec::BitVec; let mut bv = BitVec::from_elem(3, true); bv.set(1, false); assert_eq!(bv.to_bytes(), [0b10100000]); let mut bv = BitVec::from_elem(9, false); bv.set(2, true); bv.set(8, true); assert_eq!(bv.to_bytes(), [0b00100000, 0b10000000]);
pub fn eq_vec(&self, v: &[bool]) -> bool
[src]
pub fn eq_vec(&self, v: &[bool]) -> bool
[src]Compares a BitVec
to a slice of bool
s.
Both the BitVec
and slice must have the same length.
Panics
Panics if the BitVec
and slice are of different length.
Examples
use bit_vec::BitVec; let bv = BitVec::from_bytes(&[0b10100000]); assert!(bv.eq_vec(&[true, false, true, false, false, false, false, false]));
pub fn truncate(&mut self, len: usize)
[src]
pub fn truncate(&mut self, len: usize)
[src]Shortens a BitVec
, dropping excess elements.
If len
is greater than the vectorβs current length, this has no
effect.
Examples
use bit_vec::BitVec; let mut bv = BitVec::from_bytes(&[0b01001011]); bv.truncate(2); assert!(bv.eq_vec(&[false, true]));
pub fn reserve(&mut self, additional: usize)
[src]
pub fn reserve(&mut self, additional: usize)
[src]Reserves capacity for at least additional
more bits to be inserted in the given
BitVec
. The collection may reserve more space to avoid frequent reallocations.
Panics
Panics if the new capacity overflows usize
.
Examples
use bit_vec::BitVec; let mut bv = BitVec::from_elem(3, false); bv.reserve(10); assert_eq!(bv.len(), 3); assert!(bv.capacity() >= 13);
pub fn reserve_exact(&mut self, additional: usize)
[src]
pub fn reserve_exact(&mut self, additional: usize)
[src]Reserves the minimum capacity for exactly additional
more bits to be inserted in the
given BitVec
. Does nothing if the capacity is already sufficient.
Note that the allocator may give the collection more space than it requests. Therefore
capacity can not be relied upon to be precisely minimal. Prefer reserve
if future
insertions are expected.
Panics
Panics if the new capacity overflows usize
.
Examples
use bit_vec::BitVec; let mut bv = BitVec::from_elem(3, false); bv.reserve(10); assert_eq!(bv.len(), 3); assert!(bv.capacity() >= 13);
pub fn capacity(&self) -> usize
[src]
pub fn capacity(&self) -> usize
[src]Returns the capacity in bits for this bit vector. Inserting any element less than this amount will not trigger a resizing.
Examples
use bit_vec::BitVec; let mut bv = BitVec::new(); bv.reserve(10); assert!(bv.capacity() >= 10);
pub fn pop(&mut self) -> Option<bool>
[src]
pub fn pop(&mut self) -> Option<bool>
[src]Removes the last bit from the BitVec, and returns it. Returns None if the BitVec is empty.
Examples
use bit_vec::BitVec; let mut bv = BitVec::from_bytes(&[0b01001001]); assert_eq!(bv.pop(), Some(true)); assert_eq!(bv.pop(), Some(false)); assert_eq!(bv.len(), 6);
pub fn push(&mut self, elem: bool)
[src]
pub fn push(&mut self, elem: bool)
[src]Pushes a bool
onto the end.
Examples
use bit_vec::BitVec; let mut bv = BitVec::new(); bv.push(true); bv.push(false); assert!(bv.eq_vec(&[true, false]));
pub unsafe fn set_len(&mut self, len: usize)
[src]
pub unsafe fn set_len(&mut self, len: usize)
[src]Sets the number of bits that this BitVec considers initialized.
Almost certainly can cause bad stuff. Only really intended for BitSet.
pub fn shrink_to_fit(&mut self)
[src]
pub fn shrink_to_fit(&mut self)
[src]Shrinks the capacity of the underlying storage as much as possible.
It will drop down as close as possible to the length but the allocator may still inform the underlying storage that there is space for a few more elements/bits.
Trait Implementations
impl<'_> Encode<'_, Postgres> for BitVec<u32>
[src]
impl<'_> Encode<'_, Postgres> for BitVec<u32>
[src]pub fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull
[src]
pub fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull
[src]Writes the value of self
into buf
without moving self
. Read more
pub fn size_hint(&self) -> usize
[src]
#[must_use]fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
[src]
#[must_use]fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
[src]Writes the value of self
into buf
in the expected format for the database.
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
[src]
impl<B> Extend<bool> for BitVec<B> where
B: BitBlock,
[src]
impl<B> Extend<bool> for BitVec<B> where
B: BitBlock,
[src]pub fn extend<I>(&mut self, iterable: I) where
I: IntoIterator<Item = bool>,
[src]
pub fn extend<I>(&mut self, iterable: I) where
I: IntoIterator<Item = bool>,
[src]Extends a collection with the contents of an iterator. Read more
fn extend_one(&mut self, item: A)
[src]
fn extend_one(&mut self, item: A)
[src]extend_one
)Extends a collection with exactly one element.
fn extend_reserve(&mut self, additional: usize)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl<B> FromIterator<bool> for BitVec<B> where
B: BitBlock,
[src]
impl<B> FromIterator<bool> for BitVec<B> where
B: BitBlock,
[src]impl<B> IntoIterator for BitVec<B> where
B: BitBlock,
[src]
impl<B> IntoIterator for BitVec<B> where
B: BitBlock,
[src]impl<'a, B> IntoIterator for &'a BitVec<B> where
B: BitBlock,
[src]
impl<'a, B> IntoIterator for &'a BitVec<B> where
B: BitBlock,
[src]impl<B> Ord for BitVec<B> where
B: BitBlock,
[src]
impl<B> Ord for BitVec<B> where
B: BitBlock,
[src]impl<B> PartialOrd<BitVec<B>> for BitVec<B> where
B: BitBlock,
[src]
impl<B> PartialOrd<BitVec<B>> for BitVec<B> where
B: BitBlock,
[src]pub fn partial_cmp(&self, other: &BitVec<B>) -> Option<Ordering>
[src]
pub fn partial_cmp(&self, other: &BitVec<B>) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Type<Postgres> for BitVec<u32>
[src]
impl Type<Postgres> for BitVec<u32>
[src]pub fn type_info() -> PgTypeInfo
[src]
pub fn type_info() -> PgTypeInfo
[src]Returns the canonical SQL type for this Rust type. Read more
pub fn compatible(ty: &PgTypeInfo) -> bool
[src]
pub fn compatible(ty: &PgTypeInfo) -> bool
[src]Determines if this Rust type is compatible with the given SQL type. Read more
impl<B> Eq for BitVec<B> where
B: BitBlock,
[src]
B: BitBlock,
Auto Trait Implementations
impl<B> RefUnwindSafe for BitVec<B> where
B: RefUnwindSafe,
B: RefUnwindSafe,
impl<B> Send for BitVec<B> where
B: Send,
B: Send,
impl<B> Sync for BitVec<B> where
B: Sync,
B: Sync,
impl<B> Unpin for BitVec<B> where
B: Unpin,
B: Unpin,
impl<B> UnwindSafe for BitVec<B> where
B: UnwindSafe,
B: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
pub fn equivalent(&self, key: &K) -> bool
[src]Compare self to key
and return true
if they are equal.
impl<T> FmtForward for T
impl<T> FmtForward for T
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
Causes self
to use its Binary
implementation when Debug
-formatted.
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
Causes self
to use its Display
implementation when
Debug
-formatted. Read more
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
Causes self
to use its LowerExp
implementation when
Debug
-formatted. Read more
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
Causes self
to use its LowerHex
implementation when
Debug
-formatted. Read more
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
Causes self
to use its Octal
implementation when Debug
-formatted.
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
Causes self
to use its Pointer
implementation when
Debug
-formatted. Read more
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
Causes self
to use its UpperExp
implementation when
Debug
-formatted. Read more
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
Causes self
to use its UpperHex
implementation when
Debug
-formatted. Read more
impl<T> Pipe for T where
T: ?Sized,
impl<T> Pipe for T where
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
Pipes by value. This is generally the method you want to use. Read more
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
Borrows self
and passes that borrow into the pipe function. Read more
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
Mutably borrows self
and passes that borrow into the pipe function. Read more
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
Borrows self
, then passes self.borrow()
into the pipe function. Read more
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
Mutably borrows self
, then passes self.borrow_mut()
into the pipe
function. Read more
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.as_ref()
into the pipe function.
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
Mutably borrows self
, then passes self.as_mut()
into the pipe
function. Read more
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.deref()
into the pipe function.
impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
impl<T> PipeDeref for T
impl<T> PipeDeref for T
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
Self: Deref,
R: 'a,
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
Self: Deref,
R: 'a,
Pipes a dereference into a function that cannot normally be called in suffix position. Read more
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more
impl<T> PipeRef for T
impl<T> PipeRef for T
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> Tap for T
impl<T> Tap for T
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Immutable access to the Borrow<B>
of a value. Read more
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the BorrowMut<B>
of a value. Read more
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Immutable access to the AsRef<R>
view of a value. Read more
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Mutable access to the AsMut<R>
view of a value. Read more
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
Immutable access to the Deref::Target
of a value. Read more
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Mutable access to the Deref::Target
of a value. Read more
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls .tap()
only in debug builds, and is erased in release builds.
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls .tap_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Calls .tap_borrow()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Calls .tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Calls .tap_ref()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Calls .tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more
impl<T> Tap for T
impl<T> Tap for T
fn tap<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
Provides immutable access for inspection. Read more
fn tap_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
Calls tap
in debug builds, and does nothing in release builds.
fn tap_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
Provides mutable access for modification. Read more
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
Calls tap_mut
in debug builds, and does nothing in release builds.
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
fn tap_ref<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
Provides immutable access to the reference for inspection.
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
Calls tap_ref
in debug builds, and does nothing in release builds.
fn tap_ref_mut<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
Provides mutable access to the reference for modification.
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
Calls tap_ref_mut
in debug builds, and does nothing in release builds.
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
fn tap_borrow<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
Provides immutable access to the borrow for inspection. Read more
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
Calls tap_borrow
in debug builds, and does nothing in release builds.
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Provides mutable access to the borrow for modification.
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Calls tap_borrow_mut
in debug builds, and does nothing in release
builds. Read more
impl<T> TapDeref for T
impl<T> TapDeref for T
fn tap_deref<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
Immutably dereferences self
for inspection.
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
Calls tap_deref
in debug builds, and does nothing in release builds.
fn tap_deref_mut<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Mutably dereferences self
for modification.
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Calls tap_deref_mut
in debug builds, and does nothing in release
builds. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]π¬ This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,