[][src]Struct bitvec::boxed::BitBox

#[repr(C)]
pub struct BitBox<C = BigEndian, T = u8> where
    C: Cursor,
    T: BitStore
{ /* fields omitted */ }

A pointer type for owned bit sequences.

This type is essentially a &BitSlice that owns its own memory. It can change the contents of its domain, but it cannot change its own domain like BitVec can. It is useful for fixed-size collections without lifetime tracking.

Type Parameters

  • C: Cursor: An implementor of the Cursor trait. This type is used to convert semantic indices into concrete bit positions in elements, and store or retrieve bit values from the storage type.
  • T: BitStore: An implementor of the BitStore trait: u8, u16, u32, or u64 (64-bit systems only). This is the actual type in memory that the box will use to store data.

Safety

The BitBox handle has the same size as standard Rust Box<[T]> handles, but it is extremely binary incompatible with them. Attempting to treat BitBox<_, T> as Box<[T]> in any manner except through the provided APIs is catastrophically unsafe and unsound.

Trait Implementations

BitBox<C, T> implements all the traits that BitSlice<C, T> does, by deferring to the BitSlice implementation. It also implements conversion traits to and from BitSlice, and to/from BitVec.

Methods

impl<C, T> BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

pub fn empty() -> Self[src]

Constructs an empty boxed bitslice.

Returns

An empty BitBox at an arbitrary location.

Examples

use bitvec::prelude::*;

let bb: BitBox = BitBox::empty();
assert!(bb.is_empty());

pub fn from_element(elt: T) -> Self[src]

Produces a BitBox from a single element.

Parameters

  • elt: The source element from which to make the BitBox.

Returns

A BitBox containing the provided element.

Examples

use bitvec::prelude::*;

let bb: BitBox<BigEndian, u16> = BitBox::from_element(!0);
assert!(bb.all());

pub fn from_slice(slice: &[T]) -> Self[src]

Builds a BitBox from a borrowed slice of elements.

Parameters

  • slice: The source slice from which to make the BitBox.

Returns

A BitBox containing the (cloned) provided slice.

Panics

This function may panic if the provided slice is longer than the BitBox can support.

Examples

use bitvec::prelude::*;

let src = [5, 10];
let bb: BitBox = BitBox::from_slice(&src[..]);
assert!(bb[5]);
assert!(bb[7]);
assert!(bb[12]);
assert!(bb[14]);

pub fn from_bitslice(slice: &BitSlice<C, T>) -> Self[src]

Clones a &BitSlice into a BitBox.

Parameters

  • slice: The bit slice to clone into a bit box.

Returns

A BitBox containing the same bits as the source slice.

Examples

use bitvec::prelude::*;

let src = [0u8, !0];
let bb = BitBox::<BigEndian, _>::from_bitslice(src.as_bitslice());
assert_eq!(bb.len(), 16);
assert!(bb.some());

pub fn from_boxed_slice(boxed: Box<[T]>) -> Self[src]

Produces a BitBox from an owned slice of elements.

Parameters

  • slice: The source boxed slice from which to make the BitBox.

Returns

A BitBox governing the same slice that was passed in. This function does not reallocate.

Panics

This function may panic if the provided slice is longer than the BitBox can support.

Examples

use bitvec::prelude::*;

let slice: Box<[u16]> = vec![0, !0].into_boxed_slice();
let bb = BitBox::<LittleEndian, _>::from_boxed_slice(slice);
assert!(bb.some());
assert_eq!(bb.len(), 32);

pub fn into_boxed_slice(self) -> Box<[T]>[src]

Removes the BitBox wrapper from a Box<[T]>.

Parameters

  • self

Returns

The Box<[T]> underneath self.

Examples

use bitvec::prelude::*;

let slice: Box<[u16]> = vec![0, !0].into_boxed_slice();
let bb = BitBox::<LittleEndian, _>::from_boxed_slice(slice);
assert_eq!(bb.len(), 32);
let slice = bb.into_boxed_slice();
assert_eq!(slice.len(), 2);

pub unsafe fn from_raw(pointer: BitPtr<T>) -> Self[src]

Constructs a BitBox from a raw BitPtr.

After calling this function, the raw pointer is owned by the resulting BitBox. The BitBox will deallocate the memory region it describes.

Parameters

  • pointer: A BitPtr<T> describing a region of owned memory. This must have previously produced by BitBox constructors; it is unsound to even pass in BitPtr<T> values taken from BitVec<C, T> handles.

Returns

An owned BitBox over the given pointer.

Safety

Because Rust does not specify the allocation scheme used, the only valid pointer to pass into this function is one that had previously been produced by BitBox constructors and extracted by BitBox::into_raw.

This function is unsafe because improper use can lead to double-free errors (constructing multiple BitBoxes from the same BitPtr) or allocator inconsistencies (arbitrary pointers).

pub unsafe fn into_raw(self) -> BitPtr<T>[src]

Consumes the BitBox, returning the wrapped BitPtr directly.

After calling this function, the caller is responsible for the memory previously managed by the BitBox. In particular, the caller must properly release the memory region to which the BitPtr refers. The proper way to do so is to convert the BitPtr back into a BitBox with the BitBox::from_raw function.

pub fn leak<'a>(self) -> &'a mut BitSlice<C, T>[src]

Consumes and leaks the BitBox, returning a mutable reference, &'a mut BitSlice<C, T>. Note that the memory region [T] must outlive the chosen lifetime 'a.

This function is mainly useful for bit regions that live for the remainder of the program’s life. Dropping the returned reference will cause a memory leak. If this is not acceptable, the reference should first be wrapped with the Box::from_raw function, producing a BitBox. This BitBox can then be dropped which will properly deallocate the memory.

Parameters

  • b: The BitBox to deconstruct.

Returns

The slice formerly governed by the BitBox, which will never deallocate.

pub fn add_reverse<I>(self, addend: I) -> Self where
    I: IntoIterator<Item = bool>, 
[src]

Performs “reverse” addition (left to right instead of right to left).

This delegates to BitSlice::add_assign_reverse.

Parameters

  • self
  • addend: impl IntoIterator<Item=bool>: A bitstream to add to self.

Returns

The sum of self and addend.

pub fn change_cursor<D>(self) -> BitBox<D, T> where
    D: Cursor
[src]

Changes the cursor on a box handle, without changing the data it governs.

Parameters

  • self

Returns

An equivalent handle to the same data, with a new cursor parameter.

pub fn as_bitslice(&self) -> &BitSlice<C, T>[src]

Accesses the BitSlice<C, T> to which the BitBox refers.

Parameters

  • &self

Returns

The slice of bits behind the box.

pub fn as_mut_bitslice(&mut self) -> &mut BitSlice<C, T>[src]

Accesses the BitSlice<C, T> to which the BitBox refers.

Parameters

  • &mut self

Returns

The slice of bits behind the box.

Methods from Deref<Target = BitSlice<C, T>>

pub fn len(&self) -> usize[src]

Returns the number of bits contained in the BitSlice.

Parameters

  • &self

Returns

The number of live bits in the slice domain.

Examples

use bitvec::prelude::*;

let store = 0u8;
let bs = store.as_bitslice::<BigEndian>();
assert_eq!(bs.len(), 8);

pub fn is_empty(&self) -> bool[src]

Tests if the slice is empty.

Parameters

  • &self

Returns

Whether the slice has no live bits.

Examples

use bitvec::prelude::*;

let bs = BitSlice::<BigEndian, u8>::empty();
assert!(bs.is_empty());
let bs = 0u8.as_bitslice::<BigEndian>();
assert!(!bs.is_empty());

pub fn first(&self) -> Option<bool>[src]

Gets the first element of the slice, if present.

Parameters

  • &self

Returns

None if the slice is empty, or Some(bit) if it is not.

Examples

use bitvec::prelude::*;

assert!(BitSlice::<BigEndian, u8>::empty().first().is_none());
assert!(128u8.as_bitslice::<BigEndian>().first().unwrap());

pub fn split_first(&self) -> Option<(bool, &Self)>[src]

Returns the first and all the rest of the bits of the slice, or None if it is empty.

Parameters

  • &self

Returns

If the slice is empty, this returns None, otherwise, it returns Some of:

  • the first bit
  • a &BitSlice of all the rest of the bits (this may be empty)

Examples

use bitvec::prelude::*;

assert!(BitSlice::<BigEndian, u8>::empty().split_first().is_none());

let store = 128u8;
let bits = store.as_bitslice::<BigEndian>();
let (h, t) = bits.split_first().unwrap();
assert!(h);
assert!(t.not_any());

let (h, t) = bits[0 .. 1].split_first().unwrap();
assert!(h);
assert!(t.is_empty());

pub fn split_first_mut(&mut self) -> Option<(bool, &mut Self)>[src]

Returns the first and all the rest of the bits of the slice, or None if it is empty.

Parameters

  • &self

Returns

If the slice is empty, this returns None, otherwise, it returns Some of:

  • the first bit
  • a &mut BitSlice of all the rest of the bits (this may be empty)

Examples

use bitvec::prelude::*;

let mut store = 0u8;
let bits = store.as_mut_bitslice::<LittleEndian>();
assert!(!bits[0]);
*bits.at(0) = true;
let (h, t) = bits.split_first_mut().unwrap();
assert!(h);
assert_eq!(t.len(), 7);

pub fn split_last(&self) -> Option<(bool, &Self)>[src]

Returns the last and all the rest of the bits in the slice, or None if it is empty.

Parameters

  • &self

Returns

If the slice is empty, this returns None, otherwise, it returns Some of:

  • the last bit
  • a &BitSlice of all the rest of the bits (this may be empty)

Examples

use bitvec::prelude::*;

assert!(BitSlice::<BigEndian, u8>::empty().split_last().is_none());

let bits = 1u8.as_bitslice::<BigEndian>();
let (t, h) = bits.split_last().unwrap();
assert!(t);
assert!(h.not_any());

let bits = &bits[7 .. 8];
let (t, h) = bits.split_last().unwrap();
assert!(t);
assert!(h.is_empty());

pub fn split_last_mut(&mut self) -> Option<(bool, &mut Self)>[src]

Returns the last and all the rest of the bits in the slice, or None if it is empty.

Parameters

  • &self

Returns

If the slice is empty, this returns None, otherwise, it returns Some of:

  • the last bit
  • a &BitSlice of all the rest of the bits (this may be empty)

Examples

use bitvec::prelude::*;

let mut store = 0u8;
let bits = store.as_mut_bitslice::<LittleEndian>();
assert!(!bits[7]);
*bits.at(7) = true;
let (h, t) = bits.split_last_mut().unwrap();
assert!(h);
assert_eq!(t.len(), 7);

pub fn last(&self) -> Option<bool>[src]

Gets the last element of the slice, or None if it is empty.

Parameters

  • &self

Returns

None if the slice is empty, or Some(bit) if it is not.

Examples

use bitvec::prelude::*;

assert!(BitSlice::<BigEndian, u8>::empty().last().is_none());
assert!(1u8.as_bitslice::<BigEndian>().last().unwrap());

pub fn get(&self, index: usize) -> Option<bool>[src]

Gets the bit value at the given position.

Parameters

  • &self
  • index: The bit index to retrieve.

Returns

The bit at the specified index, if any. If index is beyond the bounds of self, then None is produced.

Examples

use bitvec::prelude::*;

let bits = 8u8.as_bitslice::<BigEndian>();
assert!(bits.get(4).unwrap());
assert!(!bits.get(3).unwrap());
assert!(bits.get(10).is_none());

pub unsafe fn get_unchecked(&self, index: usize) -> bool[src]

Looks up a bit at an index, without doing bounds checking.

This is generally not recommended; use with caution! For a safe alternative, see get.

Parameters

  • &self
  • index: The bit index to retrieve. This index is not checked against the length of self.

Returns

The bit at the requested index.

Safety

This method is not safe. It performs raw pointer arithmetic to seek from the start of the slice to the requested index, and look up the bit there. It does not inspect the length of self, and it is free to perform out-of-bounds memory access.

Use this method only when you have already performed the bounds check, and can guarantee that the call occurs with a safely in-bounds index.

Examples

This example uses a bit slice of length 2, and demonstrates out-of-bounds access to the last bit in the element.

use bitvec::prelude::*;

let src = 1u8;
let bits = &src.as_bitslice::<BigEndian>()[2 .. 4];
assert_eq!(bits.len(), 2);
assert!(unsafe { bits.get_unchecked(5) });

pub fn set(&mut self, index: usize, value: bool)[src]

Sets the bit value at the given position.

Parameters

  • &mut self
  • index: The bit index to set. It must be in the domain 0 .. self.len().
  • value: The value to be set, true for 1 and false for 0.

Panics

This method panics if index is outside the slice domain.

Examples

use bitvec::prelude::*;

let mut store = 8u8;
let bits = store.as_mut_bitslice::<BigEndian>();
assert!(!bits[3]);
bits.set(3, true);
assert!(bits[3]);

pub unsafe fn set_unchecked(&mut self, index: usize, value: bool)[src]

Sets a bit at an index, without doing bounds checking.

This is generally not recommended; use with caution! For a safe alternative, see set.

Parameters

  • &mut self
  • index: The bit index to retrieve. This index is not checked against the length of self.

Effects

The bit at index is set to value.

Safety

This method is not safe. It performs raw pointer arithmetic to seek from the start of the slice to the requested index, and set the bit there. It does not inspect the length of self, and it is free to perform out-of-bounds memory write access.

Use this method only when you have already performed the bounds check, and can guarantee that the call occurs with a safely in-bounds index.

Examples

This example uses a bit slice of length 2, and demonstrates out-of-bounds access to the last bit in the element.

use bitvec::prelude::*;

let mut src = 0u8;
{
 let bits = &mut src.as_mut_bitslice::<BigEndian>()[2 .. 4];
 assert_eq!(bits.len(), 2);
 unsafe { bits.set_unchecked(5, true); }
}
assert_eq!(src, 1);

pub fn at(&mut self, index: usize) -> BitGuard<C, T>[src]

Produces a write reference to a single bit in the slice.

The structure returned by this method extends the borrow until it drops, which precludes parallel use.

The split_at_mut method allows splitting the borrows of a slice, and will enable safe parallel use of these write references. The atomic feature guarantees that parallel use does not cause data races when modifying the underlying slice.

Lifetimes

  • 'a Propagates the lifetime of the referent slice to the single-bit reference produced.

Parameters

  • &mut self
  • index: The index of the bit in self selected.

Returns

A write reference to the requested bit. Due to Rust limitations, this is not a native reference type, but is a custom structure that holds the address of the requested bit and its value. The produced structure implements Deref and DerefMut to its cached bit, and commits the cached bit to the parent slice on drop.

Usage

You must use the dereference operator on the .at() expression in order to assign to it. In general, you should prefer immediately using and discarding the returned value, rather than binding it to a name and letting it live for more than one statement.

Examples

use bitvec::prelude::*;

let mut src = 0u8;
let bits = src.as_mut_bitslice::<BigEndian>();

assert!(!bits[0]);
*bits.at(0) = true;
//  note the leading dereference.
assert!(bits[0]);

This example shows multiple usage by using split_at_mut.

use bitvec::prelude::*;

let mut src = 0u8;
let bits = src.as_mut_bitslice::<BigEndian>();

{
 let (mut a, rest) = bits.split_at_mut(2);
 let (mut b, rest) = rest.split_at_mut(3);
 *a.at(0) = true;
 *b.at(0) = true;
 *rest.at(0) = true;
}

assert_eq!(bits.as_slice()[0], 0b1010_0100);
//                               a b   rest

The above example splits the slice into three (the first, the second, and the rest) in order to hold multiple write references into the slice.

pub fn as_ptr(&self) -> *const T[src]

Retrieves a read pointer to the start of the underlying data slice.

Parameters

  • &self

Returns

A pointer to the first element, partial or not, in the underlying store.

If self is empty, then the null pointer is returned.

Safety

The caller must ensure that the slice outlives the pointer this function returns, or else it will dangle and point to garbage.

Modifying the container referenced by this slice may cause its buffer to reallocate, which would also make any pointers to it invalid.

Examples

use bitvec::prelude::*;

let src = [0u8; 4];
let bits = src.as_bitslice::<BigEndian>();
assert_eq!(src.as_ptr(), bits.as_ptr());

pub fn as_mut_ptr(&mut self) -> *mut T[src]

Retrieves a write pointer to the start of the underlying data slice.

Parameters

  • &mut self

Returns

A pointer to the first element, partial or not, in the underlying store.

If self is empty, then the null pointer is returned.

Safety

The caller must ensure that the slice outlives the pointer this function returns, or else it will dangle and point to garbage.

Modifying the container referenced by this slice may cause its buffer to reallocate, which would also make any pointers to it invalid.

Examples

use bitvec::prelude::*;

let mut src = [0u8; 4];
let src_ptr = src.as_mut_ptr();
let bits = src.as_mut_bitslice::<BigEndian>();
assert_eq!(src_ptr, bits.as_mut_ptr());

pub fn swap(&mut self, a: usize, b: usize)[src]

Swaps two bits in the slice.

Parameters

  • &mut self
  • a: The first index to be swapped.
  • b: The second index to be swapped.

Panics

Panics if either a or b are out of bounds.

Examples

use bitvec::prelude::*;

let mut store = 32u8;
let bits = store.as_mut_bitslice::<BigEndian>();
assert!(!bits[0]);
assert!(bits[2]);
bits.swap(0, 2);
assert!(bits[0]);
assert!(!bits[2]);

pub fn reverse(&mut self)[src]

Reverses the order of bits in the slice, in place.

Parameters

  • &mut self

Examples

use bitvec::prelude::*;

let mut src = 0b1010_1010u8;
{
  let bits = src.as_mut_bitslice::<BigEndian>();
  bits[1 .. 7].reverse();
}
eprintln!("{:b}", src);
assert_eq!(src, 0b1101_0100);

Important traits for Iter<'a, C, T>
pub fn iter(&self) -> Iter<C, T>[src]

Provides read-only iteration across the slice domain.

The iterator returned from this method implements ExactSizeIterator and DoubleEndedIterator just as the consuming .into_iter() method’s iterator does.

Parameters

  • &self

Returns

An iterator over all bits in the slice domain, in C and T ordering.

Examples

use bitvec::prelude::*;

let src = 64u8;
let bits = src.as_bitslice::<BigEndian>();
let mut iter = bits[.. 2].iter();
assert!(!iter.next().unwrap());
assert!(iter.next().unwrap());
assert!(iter.next().is_none());

Important traits for Windows<'a, C, T>
pub fn windows(&self, size: usize) -> Windows<C, T>[src]

Produces a sliding iterator over consecutive windows in the slice. Each windows has the width size. The windows overlap. If the slice is shorter than size, the produced iterator is empty.

Parameters

  • &self
  • size: The width of each window.

Returns

An iterator which yields sliding views into the slice.

Panics

This function panics if the size is zero.

Examples

use bitvec::prelude::*;

let src = 0b0100_1011u8;
let bits = src.as_bitslice::<BigEndian>();
let mut windows = bits.windows(4);
assert_eq!(windows.next(), Some(&bits[0 .. 4]));
assert_eq!(windows.next(), Some(&bits[1 .. 5]));
assert_eq!(windows.next(), Some(&bits[2 .. 6]));
assert_eq!(windows.next(), Some(&bits[3 .. 7]));
assert_eq!(windows.next(), Some(&bits[4 .. 8]));
assert!(windows.next().is_none());

Important traits for Chunks<'a, C, T>
pub fn chunks(&self, size: usize) -> Chunks<C, T>[src]

Produces a galloping iterator over consecutive chunks in the slice. Each chunk, except possibly the last, has the width size. The chunks do not overlap. If the slice is shorter than size, the produced iterator produces only one chunk.

Parameters

  • &self
  • size: The width of each chunk.

Returns

An iterator which yields consecutive chunks of the slice.

Panics

This function panics if the size is zero.

Examples

use bitvec::prelude::*;

let src = 0b0100_1011u8;
let bits = src.as_bitslice::<BigEndian>();
let mut chunks = bits.chunks(3);
assert_eq!(chunks.next(), Some(&bits[0 .. 3]));
assert_eq!(chunks.next(), Some(&bits[3 .. 6]));
assert_eq!(chunks.next(), Some(&bits[6 .. 8]));
assert!(chunks.next().is_none());

Important traits for ChunksMut<'a, C, T>
pub fn chunks_mut(&mut self, size: usize) -> ChunksMut<C, T>[src]

Produces a galloping iterator over consecutive chunks in the slice. Each chunk, except possibly the last, has the width size. The chunks do not overlap. If the slice is shorter than size, the produced iterator produces only one chunk.

Parameters

  • &mut self
  • size: The width of each chunk.

Returns

An iterator which yields consecutive mutable chunks of the slice.

Panics

This function panics if the size is zero.

Examples

use bitvec::prelude::*;

let mut src = 0b0100_1011u8;
{
 let bits = src.as_mut_bitslice::<BigEndian>();
 let mut chunks = bits.chunks_mut(3);
 chunks.next().unwrap().set(2, true);
 chunks.next().unwrap().set(2, true);
 chunks.next().unwrap().set(1, false);
}
assert_eq!(src, 0b0110_1110);

Important traits for ChunksExact<'a, C, T>
pub fn chunks_exact(&self, size: usize) -> ChunksExact<C, T>[src]

Produces a galloping iterator over consecutive chunks in the slice. Each chunk has the width size. If size does not evenly divide the slice, then the remainder is not part of the iteration, and can be accessed separately with the .remainder() method.

Parameters

  • &self
  • size: The width of each chunk.

Returns

An iterator which yields consecutive chunks of the slice.

Panics

This function panics if size is zero.

Examples

use bitvec::prelude::*;

let src = 0b0100_1011u8;
let bits = src.as_bitslice::<BigEndian>();
let mut chunks_exact = bits.chunks_exact(3);
assert_eq!(chunks_exact.next(), Some(&bits[0 .. 3]));
assert_eq!(chunks_exact.next(), Some(&bits[3 .. 6]));
assert!(chunks_exact.next().is_none());
assert_eq!(chunks_exact.remainder(), &bits[6 .. 8]);

Important traits for ChunksExactMut<'a, C, T>
pub fn chunks_exact_mut(&mut self, size: usize) -> ChunksExactMut<C, T>[src]

Produces a galloping iterator over consecutive chunks in the slice. Each chunk has the width size. If size does not evenly divide the slice, then the remainder is not part of the iteration, and can be accessed separately with the .remainder() method.

Parameters

  • &mut self
  • size: The width of each chunk.

Returns

An iterator which yields consecutive mutable chunks of the slice.

Panics

This function panics if size is zero.

Examples

use bitvec::prelude::*;

let mut src = 0b0100_1011u8;
{
 let bits = src.as_mut_bitslice::<BigEndian>();
 let mut chunks_exact = bits.chunks_exact_mut(3);
 chunks_exact.next().unwrap().set(2, true);
 chunks_exact.next().unwrap().set(2, true);
 assert!(chunks_exact.next().is_none());
}
assert_eq!(src, 0b0110_1111);

Important traits for RChunks<'a, C, T>
pub fn rchunks(&self, size: usize) -> RChunks<C, T>[src]

Produces a galloping iterator over consecutive chunks in the slice, from the back to the front. Each chunk, except possibly the front, has the width size. The chunks do not overlap. If the slice is shorter than size, then the iterator produces one item.

Parameters

  • &self
  • size: The width of each chunk.

Returns

An iterator which yields consecutive chunks of the slice, from the back to the front.

Panics

This function panics if size is zero.

Examples

use bitvec::prelude::*;

let src = 0b0100_1011u8;
let bits = src.as_bitslice::<BigEndian>();
let mut rchunks = bits.rchunks(3);
assert_eq!(rchunks.next(), Some(&bits[5 .. 8]));
assert_eq!(rchunks.next(), Some(&bits[2 .. 5]));
assert_eq!(rchunks.next(), Some(&bits[0 .. 2]));
assert!(rchunks.next().is_none());

Important traits for RChunksMut<'a, C, T>
pub fn rchunks_mut(&mut self, size: usize) -> RChunksMut<C, T>[src]

Produces a galloping iterator over consecutive chunks in the slice, from the back to the front. Each chunk, except possibly the front, has the width size. The chunks do not overlap. If the slice is shorter than size, then the iterator produces one item.

Parameters

  • &mut self
  • size: The width of each chunk.

Returns

An iterator which yields consecutive mutable chunks of the slice, from the back to the front.

Panics

This function panics if size is zero.

Examples

use bitvec::prelude::*;

let mut src = 0b0100_1011u8;
{
 let bits = src.as_mut_bitslice::<BigEndian>();
 let mut rchunks = bits.rchunks_mut(3);
 rchunks.next().unwrap().set(0, true);
 rchunks.next().unwrap().set(2, false);
 rchunks.next().unwrap().set(1, false);
 assert!(rchunks.next().is_none());
}
assert_eq!(src, 0b0000_0111);

Important traits for RChunksExact<'a, C, T>
pub fn rchunks_exact(&self, size: usize) -> RChunksExact<C, T>[src]

Produces a galloping iterator over consecutive chunks in the slice, from the back to the front. Each chunk has the width size. If size does not evenly divide the slice, then the remainder is not part of the iteration, and can be accessed separately with the .remainder() method.

Parameters

  • &self
  • size: The width of each chunk.

Returns

An iterator which yields consecutive chunks of the slice, from the back to the front.

Panics

This function panics if size is zero.

Examples

use bitvec::prelude::*;

let store: &[u8] = &[0b0100_1011];
let bits: &BitSlice = store.into();
let mut rchunks_exact = bits.rchunks_exact(3);
assert_eq!(rchunks_exact.next(), Some(&bits[5 .. 8]));
assert_eq!(rchunks_exact.next(), Some(&bits[2 .. 5]));
assert!(rchunks_exact.next().is_none());
assert_eq!(rchunks_exact.remainder(), &bits[0 .. 2]);

Important traits for RChunksExactMut<'a, C, T>
pub fn rchunks_exact_mut(&mut self, size: usize) -> RChunksExactMut<C, T>[src]

Produces a galloping iterator over consecutive chunks in the slice, from the back to the front. Each chunk has the width size. If size does not evenly divide the slice, then the remainder is not part of the iteration, and can be accessed separately with the .remainder() method.

Parameters

  • &mut self
  • size: The width of each chunk.

Returns

An iterator which yields consecutive mutable chunks of the slice, from the back to the front.

Panics

This function panics if size is zero.

Examples

use bitvec::prelude::*;

let mut src = 0b0100_1011u8;
{
 let bits = src.as_mut_bitslice::<BigEndian>();
 let mut rchunks_exact = bits.rchunks_exact_mut(3);
 rchunks_exact.next().unwrap().set(0, true);
 rchunks_exact.next().unwrap().set(2, false);
 assert!(rchunks_exact.next().is_none());
}
assert_eq!(src, 0b0100_0111);

pub fn split_at(&self, mid: usize) -> (&Self, &Self)[src]

Divides one slice into two at an index.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Parameters

  • &self
  • mid: The index at which to split

Returns

  • The bits up to but not including mid.
  • The bits from mid onwards.

Panics

Panics if mid > self.len().

Examples

use bitvec::prelude::*;

let bits = 15u8.as_bitslice::<BigEndian>();

let (l, r) = bits.split_at(0);
assert!(l.is_empty());
assert_eq!(r, bits);

let (l, r) = bits.split_at(4);
assert_eq!(l, &bits[0 .. 4]);
assert_eq!(r, &bits[4 .. 8]);

let (l, r) = bits.split_at(8);
assert_eq!(l, bits);
assert!(r.is_empty());

pub fn split_at_mut(&mut self, mid: usize) -> (&mut Self, &mut Self)[src]

Divides one slice into two at an index.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Parameters

  • &mut self
  • mid: The index at which to split

Returns

  • The bits up to but not including mid.
  • The bits from mid onwards.

Panics

Panics if mid > self.len().

pub fn starts_with<D, U>(&self, prefix: &BitSlice<D, U>) -> bool where
    D: Cursor,
    U: BitStore
[src]

Tests if the slice begins with the given prefix.

Parameters

  • &self
  • prefix: Any BitSlice against which self is tested. This is not required to have the same cursor or storage types as self.

Returns

Whether self begins with prefix. This is true only if self is at least as long as prefix and their bits are semantically equal.

Examples

use bitvec::prelude::*;

let bits = 0xA6u8.as_bitslice::<BigEndian>();
assert!(bits.starts_with(&bits[.. 3]));
assert!(!bits.starts_with(&bits[3 ..]));

pub fn ends_with<D, U>(&self, suffix: &BitSlice<D, U>) -> bool where
    D: Cursor,
    U: BitStore
[src]

Tests if the slice ends with the given suffix.

Parameters

  • &self
  • suffix: Any BitSlice against which self is tested. This is not required to have the same cursor or storage types as self.

Returns

Whether self ends with suffix. This is true only if self is at least as long as suffix and their bits are semantically equal.

Examples

use bitvec::prelude::*;

let bits = 0xA6u8.as_bitslice::<BigEndian>();
assert!(bits.ends_with(&bits[5 ..]));
assert!(!bits.ends_with(&bits[.. 5]));

pub fn rotate_left(&mut self, by: usize)[src]

Rotates the slice, in place, to the left.

After calling this method, the bits from [.. by] will be at the back of the slice, and the bits from [by ..] will be at the front. This operates fully in-place.

In-place rotation of bits requires this method to take O(k × n) time. It is impossible to use machine intrinsics to perform galloping rotation on bits.

Parameters

  • &mut self
  • by: The number of bits by which to rotate left. This must be in the range 0 ..= self.len(). If it is 0 or self.len(), then this method is a no-op.

Examples

use bitvec::prelude::*;

let mut src = 0xF0u8;
let bits = src.as_mut_bitslice::<BigEndian>();
bits.rotate_left(2);
assert_eq!(bits.as_ref()[0], 0xC3);

pub fn rotate_right(&mut self, by: usize)[src]

Rotates the slice, in place, to the right.

After calling this method, the bits from [self.len() - by ..] will be at the front of the slice, and the bits from [.. self.len() - by] will be at the back. This operates fully in-place.

In-place rotation of bits requires this method to take O(k × n) time. It is impossible to use machine intrinsics to perform galloping rotation on bits.

Parameters

  • &mut self
  • by: The number of bits by which to rotate right. This must be in the range 0 ..= self.len(). If it is 0 or self.len, then this method is a no-op.

Examples

use bitvec::prelude::*;

let mut src = 0xF0u8;
let bits = src.as_mut_bitslice::<BigEndian>();
bits.rotate_right(2);
assert_eq!(bits.as_ref()[0], 0x3C);

pub fn all(&self) -> bool[src]

Tests if all bits in the slice domain are set (logical ).

Truth Table

0 0 => 0
0 1 => 0
1 0 => 0
1 1 => 1

Parameters

  • &self

Returns

Whether all bits in the slice domain are set. The empty slice returns true.

Examples

use bitvec::prelude::*;

let bits = 0xFDu8.as_bitslice::<BigEndian>();
assert!(bits[.. 4].all());
assert!(!bits[4 ..].all());

pub fn any(&self) -> bool[src]

Tests if any bit in the slice is set (logical ).

Truth Table

0 0 => 0
0 1 => 1
1 0 => 1
1 1 => 1

Parameters

  • &self

Returns

Whether any bit in the slice domain is set. The empty slice returns false.

Examples

use bitvec::prelude::*;

let bits = 0x40u8.as_bitslice::<BigEndian>();
assert!(bits[.. 4].any());
assert!(!bits[4 ..].any());

pub fn not_all(&self) -> bool[src]

Tests if any bit in the slice is unset (logical ¬∧).

Truth Table

0 0 => 1
0 1 => 1
1 0 => 1
1 1 => 0

Parameters

  • `&self

Returns

Whether any bit in the slice domain is unset.

Examples

use bitvec::prelude::*;

let bits = 0xFDu8.as_bitslice::<BigEndian>();
assert!(!bits[.. 4].not_all());
assert!(bits[4 ..].not_all());

pub fn not_any(&self) -> bool[src]

Tests if all bits in the slice are unset (logical ¬∨).

Truth Table

0 0 => 1
0 1 => 0
1 0 => 0
1 1 => 0

Parameters

  • &self

Returns

Whether all bits in the slice domain are unset.

Examples

use bitvec::prelude::*;

let bits = 0x40u8.as_bitslice::<BigEndian>();
assert!(!bits[.. 4].not_any());
assert!(bits[4 ..].not_any());

pub fn some(&self) -> bool[src]

Tests whether the slice has some, but not all, bits set and some, but not all, bits unset.

This is false if either all() or not_any() are true.

Truth Table

0 0 => 0
0 1 => 1
1 0 => 1
1 1 => 0

Parameters

  • &self

Returns

Whether the slice domain has mixed content. The empty slice returns false.

Examples

use bitvec::prelude::*;

let bits = 0b111_000_10u8.as_bitslice::<BigEndian>();
assert!(!bits[0 .. 3].some());
assert!(!bits[3 .. 6].some());
assert!(bits[6 ..].some());

pub fn count_ones(&self) -> usize[src]

Counts how many bits are set high.

Parameters

  • &self

Returns

The number of high bits in the slice domain.

Examples

use bitvec::prelude::*;

let bits = [0xFDu8, 0x25].as_bitslice::<BigEndian>();
assert_eq!(bits.count_ones(), 10);

pub fn count_zeros(&self) -> usize[src]

Counts how many bits are set low.

Parameters

  • &self

Returns

The number of low bits in the slice domain.

Examples

use bitvec::prelude::*;

let bits = [0xFDu8, 0x25].as_bitslice::<BigEndian>();
assert_eq!(bits.count_zeros(), 6);

pub fn set_all(&mut self, value: bool)[src]

Set all bits in the slice to a value.

Parameters

  • &mut self
  • value: The bit value to which all bits in the slice will be set.

Examples

use bitvec::prelude::*;

let mut src = 0u8;
let bits = src.as_mut_bitslice::<BigEndian>();
bits[2 .. 6].set_all(true);
assert_eq!(bits.as_ref(), &[0b0011_1100]);
bits[3 .. 5].set_all(false);
assert_eq!(bits.as_ref(), &[0b0010_0100]);
bits[.. 1].set_all(true);
assert_eq!(bits.as_ref(), &[0b1010_0100]);

pub fn for_each<F>(&mut self, func: F) where
    F: Fn(usize, bool) -> bool
[src]

Provides mutable traversal of the collection.

It is impossible to implement IndexMut on BitSlice, because bits do not have addresses, so there can be no &mut u1. This method allows the client to receive an enumerated bit, and provide a new bit to set at each index.

Parameters

  • &mut self
  • func: A function which receives a (usize, bool) pair of index and value, and returns a bool. It receives the bit at each position, and the return value is written back at that position.

Examples

use bitvec::prelude::*;

let mut src = 0u8;
{
 let bits = src.as_mut_bitslice::<BigEndian>();
 bits.for_each(|idx, _bit| idx % 3 == 0);
}
assert_eq!(src, 0b1001_0010);

pub fn add_assign_reverse<I>(&mut self, addend: I) -> bool where
    I: IntoIterator<Item = bool>, 
[src]

Performs “reverse” addition (left to right instead of right to left).

This addition interprets the slice, and the other addend, as having its least significant bits first in the order and its most significant bits last. This is most likely to be numerically useful under a LittleEndian Cursor type.

Parameters

  • &mut self: The addition uses self as one addend, and writes the sum back into self.
  • addend: impl IntoIterator<Item=bool>: A stream of bits. When this is another BitSlice, iteration proceeds from left to right.

Return

The final carry bit is returned

Effects

Starting from index 0 and proceeding upwards until either self or addend expires, the carry-propagated addition of self[i] and addend[i] is written to self[i].

  101111
+ 0010__ (the two missing bits are logically zero)
--------
  100000 1 (the carry-out is returned)

Examples

use bitvec::prelude::*;

let mut a = 0b0000_1010u8;
let     b = 0b0000_1100u8;
//      s =      1 0110
let ab = &mut a.as_mut_bitslice::<LittleEndian>()[.. 4];
let bb = &    b.as_bitslice::<LittleEndian>()[.. 4];
let c = ab.add_assign_reverse(bb);
assert!(c);
assert_eq!(ab.as_slice()[0], 0b0000_0110u8);

Performance Notes

When using LittleEndian Cursor types, this can be accelerated by delegating the addition to the underlying types. This is a software implementation of the ripple-carry adder, which has O(n) runtime in the number of bits. The CPU is much faster, as it has access to element-wise or vectorized addition operations.

If your use case sincerely needs binary-integer arithmetic operations on bit sets

pub fn as_slice(&self) -> &[T][src]

Accesses the backing storage of the BitSlice as a slice of its elements.

Parameters

  • &self

Returns

A slice of all the elements that the BitSlice uses for storage.

Examples

use bitvec::prelude::*;

let src = [1u8, 66];
let bits = src.as_bitslice::<BigEndian>();

let accum = bits.as_slice()
  .iter()
  .map(|elt| elt.count_ones())
  .sum::<usize>();
assert_eq!(accum, 3);

pub fn as_mut_slice(&mut self) -> &mut [T][src]

Accesses the underlying store.

Examples

use bitvec::prelude::*;

let mut src = [1u8, 64];
let bits = src.as_mut_bitslice::<BigEndian>();
for elt in bits.as_mut_slice() {
  *elt |= 2;
}
assert_eq!(&[3, 66], bits.as_slice());

pub fn change_cursor<D>(&self) -> &BitSlice<D, T> where
    D: Cursor
[src]

Changes the cursor type of the slice handle.

Parameters

  • &self

Returns

An equivalent slice handle with a new cursor type.

Type Parameters

  • D: Cursor The new cursor type to use for the handle.

Examples

use bitvec::prelude::*;

let src = 2u8;
let bits = src.as_bitslice::<BigEndian>();
assert!(bits[6]);
let bits = bits.change_cursor::<LittleEndian>();
assert!(bits[1]);

pub fn change_cursor_mut<D>(&mut self) -> &mut BitSlice<D, T> where
    D: Cursor
[src]

Changes the cursor type of the slice handle.

Parameters

  • &mut self

Returns

An equivalent slice handle with a new cursor type.

Type Parameters

  • D: Cursor The new cursor type to use for the handle.

Examples

use bitvec::prelude::*;

let mut src = 0u8;
*src.as_mut_bitslice::<BigEndian>().at(1) = true;
assert_eq!(src, 64);
src.as_mut_bitslice::<BigEndian>()
   .change_cursor_mut::<LittleEndian>()
   .set(1, true);
assert_eq!(src, 66);

pub fn bitptr(&self) -> BitPtr<T>[src]

Accesses the underlying pointer structure.

Parameters

  • &self

Returns

The BitPtr structure of the slice handle.

Trait Implementations

impl<C, T> Send for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

BitBox is safe to move across thread boundaries, as is &mut BitBox.

impl<C, T> Sync for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

&BitBox is safe to move across thread boundaries.

impl<C, T> Drop for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> AsRef<BitSlice<C, T>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> AsRef<[T]> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> AsMut<BitSlice<C, T>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> AsMut<[T]> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> Into<Box<[T]>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<'_, C, T> From<&'_ BitSlice<C, T>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<'_, C, T> From<&'_ [T]> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> From<BitVec<C, T>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> From<Box<[T]>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> From<BitBox<C, T>> for BitVec<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> IntoIterator for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Item = bool

The type of the elements being iterated over.

type IntoIter = IntoIter<C, T>

Which kind of iterator are we turning this into?

impl<'a, C, T> IntoIterator for &'a BitBox<C, T> where
    C: Cursor,
    T: 'a + BitStore
[src]

type Item = bool

The type of the elements being iterated over.

type IntoIter = <&'a BitSlice<C, T> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?

impl<C, T> Clone for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> Default for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> Eq for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> Ord for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<A, B, C, D> PartialEq<BitBox<C, D>> for BitBox<A, B> where
    A: Cursor,
    B: BitStore,
    C: Cursor,
    D: BitStore
[src]

impl<A, B, C, D> PartialEq<BitSlice<C, D>> for BitBox<A, B> where
    A: Cursor,
    B: BitStore,
    C: Cursor,
    D: BitStore
[src]

impl<A, B, C, D> PartialEq<BitBox<C, D>> for BitSlice<A, B> where
    A: Cursor,
    B: BitStore,
    C: Cursor,
    D: BitStore
[src]

impl<A, B, C, D> PartialOrd<BitBox<C, D>> for BitBox<A, B> where
    A: Cursor,
    B: BitStore,
    C: Cursor,
    D: BitStore
[src]

impl<A, B, C, D> PartialOrd<BitSlice<C, D>> for BitBox<A, B> where
    A: Cursor,
    B: BitStore,
    C: Cursor,
    D: BitStore
[src]

impl<A, B, C, D> PartialOrd<BitBox<C, D>> for BitSlice<A, B> where
    A: Cursor,
    B: BitStore,
    C: Cursor,
    D: BitStore
[src]

impl<C, T> Display for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> Debug for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> Add<BitBox<C, T>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Output = Self

The resulting type after applying the + operator.

impl<C, T> Neg for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Output = Self

The resulting type after applying the - operator.

impl<C, T> AddAssign<BitBox<C, T>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> Not for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Output = Self

The resulting type after applying the ! operator.

impl<C, T, I> BitAnd<I> for BitBox<C, T> where
    C: Cursor,
    T: BitStore,
    I: IntoIterator<Item = bool>, 
[src]

type Output = Self

The resulting type after applying the & operator.

impl<C, T, I> BitOr<I> for BitBox<C, T> where
    C: Cursor,
    T: BitStore,
    I: IntoIterator<Item = bool>, 
[src]

type Output = Self

The resulting type after applying the | operator.

impl<C, T, I> BitXor<I> for BitBox<C, T> where
    C: Cursor,
    T: BitStore,
    I: IntoIterator<Item = bool>, 
[src]

type Output = Self

The resulting type after applying the ^ operator.

impl<C, T> Shl<usize> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Output = Self

The resulting type after applying the << operator.

impl<C, T> Shr<usize> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Output = Self

The resulting type after applying the >> operator.

impl<C, T, I> BitAndAssign<I> for BitBox<C, T> where
    C: Cursor,
    T: BitStore,
    I: IntoIterator<Item = bool>, 
[src]

impl<C, T, I> BitOrAssign<I> for BitBox<C, T> where
    C: Cursor,
    T: BitStore,
    I: IntoIterator<Item = bool>, 
[src]

impl<C, T, I> BitXorAssign<I> for BitBox<C, T> where
    C: Cursor,
    T: BitStore,
    I: IntoIterator<Item = bool>, 
[src]

impl<C, T> ShlAssign<usize> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> ShrAssign<usize> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> Deref for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Target = BitSlice<C, T>

The resulting type after dereferencing.

impl<C, T> DerefMut for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> Index<usize> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Output = bool

The returned type after indexing.

impl<C, T> Index<Range<usize>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Output = BitSlice<C, T>

The returned type after indexing.

impl<C, T> Index<RangeFrom<usize>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Output = BitSlice<C, T>

The returned type after indexing.

impl<C, T> Index<RangeFull> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Output = BitSlice<C, T>

The returned type after indexing.

impl<C, T> Index<RangeInclusive<usize>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Output = BitSlice<C, T>

The returned type after indexing.

impl<C, T> Index<RangeTo<usize>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Output = BitSlice<C, T>

The returned type after indexing.

impl<C, T> Index<RangeToInclusive<usize>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

type Output = BitSlice<C, T>

The returned type after indexing.

impl<C, T> IndexMut<Range<usize>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> IndexMut<RangeFrom<usize>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> IndexMut<RangeFull> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> IndexMut<RangeInclusive<usize>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> IndexMut<RangeTo<usize>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> IndexMut<RangeToInclusive<usize>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> Hash for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> Borrow<BitSlice<C, T>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> BorrowMut<BitSlice<C, T>> for BitBox<C, T> where
    C: Cursor,
    T: BitStore
[src]

impl<C, T> Serialize for BitBox<C, T> where
    C: Cursor,
    T: BitStore + Serialize
[src]

impl<'de, C, T> Deserialize<'de> for BitBox<C, T> where
    C: Cursor,
    T: 'de + BitStore + Deserialize<'de>, 
[src]

Auto Trait Implementations

impl<C, T> Unpin for BitBox<C, T> where
    C: Unpin,
    T: Unpin

impl<C, T> UnwindSafe for BitBox<C, T> where
    C: UnwindSafe,
    T: UnwindSafe

impl<C, T> RefUnwindSafe for BitBox<C, T> where
    C: RefUnwindSafe,
    T: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]