Trait BitStore

Source
pub trait BitStore: Sized {
    // Required methods
    fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>;
    fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>;
}
Expand description

A trait for storing a value directly

§Derive

BitStore can be derived using the bit manager derive crate.

§Storage Primitives

  • bool, u8 (directly implemented)
  • u16, u32, u64
  • i8, i16, i32, i64
  • f32, f64
  • String (through StringConverter)
  • Option<T> where T can be stored
  • Result<T, F> where T and F can be stored
  • [T; 0] through [T; 32] where T can be stored
  • () (the unit type) and all tuples with 2 through 26 storable values

Required Methods§

Source

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Reads a value from the given reader.

Source

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Writes this value to the given writer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl BitStore for bool

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl BitStore for f32

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl BitStore for f64

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl BitStore for i8

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl BitStore for i16

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl BitStore for i32

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl BitStore for i64

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl BitStore for u8

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl BitStore for u16

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl BitStore for u32

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl BitStore for u64

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl BitStore for ()

Source§

impl BitStore for String

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<A, B> BitStore for (A, B)
where A: BitStore, B: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C> BitStore for (A, B, C)
where A: BitStore, B: BitStore, C: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D> BitStore for (A, B, C, D)
where A: BitStore, B: BitStore, C: BitStore, D: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E> BitStore for (A, B, C, D, E)
where A: BitStore, B: BitStore, C: BitStore, D: BitStore, E: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F> BitStore for (A, B, C, D, E, F)
where A: BitStore, B: BitStore, C: BitStore, D: BitStore, E: BitStore, F: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G> BitStore for (A, B, C, D, E, F, G)
where A: BitStore, B: BitStore, C: BitStore, D: BitStore, E: BitStore, F: BitStore, G: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H> BitStore for (A, B, C, D, E, F, G, H)
where A: BitStore, B: BitStore, C: BitStore, D: BitStore, E: BitStore, F: BitStore, G: BitStore, H: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I> BitStore for (A, B, C, D, E, F, G, H, I)
where A: BitStore, B: BitStore, C: BitStore, D: BitStore, E: BitStore, F: BitStore, G: BitStore, H: BitStore, I: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J> BitStore for (A, B, C, D, E, F, G, H, I, J)
where A: BitStore, B: BitStore, C: BitStore, D: BitStore, E: BitStore, F: BitStore, G: BitStore, H: BitStore, I: BitStore, J: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K> BitStore for (A, B, C, D, E, F, G, H, I, J, K)
where A: BitStore, B: BitStore, C: BitStore, D: BitStore, E: BitStore, F: BitStore, G: BitStore, H: BitStore, I: BitStore, J: BitStore, K: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L)
where A: BitStore, B: BitStore, C: BitStore, D: BitStore, E: BitStore, F: BitStore, G: BitStore, H: BitStore, I: BitStore, J: BitStore, K: BitStore, L: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M)
where A: BitStore, B: BitStore, C: BitStore, D: BitStore, E: BitStore, F: BitStore, G: BitStore, H: BitStore, I: BitStore, J: BitStore, K: BitStore, L: BitStore, M: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N)
where A: BitStore, B: BitStore, C: BitStore, D: BitStore, E: BitStore, F: BitStore, G: BitStore, H: BitStore, I: BitStore, J: BitStore, K: BitStore, L: BitStore, M: BitStore, N: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)
where A: BitStore, B: BitStore, C: BitStore, D: BitStore, E: BitStore, F: BitStore, G: BitStore, H: BitStore, I: BitStore, J: BitStore, K: BitStore, L: BitStore, M: BitStore, N: BitStore, O: BitStore,

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W)

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X)

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y)

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z> BitStore for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z)

Source§

fn read_from<READ: BitRead>(reader: &mut READ) -> Result<Self>

Source§

fn write_to<WRITE: BitWrite>(&self, writer: &mut WRITE) -> Result<()>

Source§

impl<T> BitStore for [T; 0]

Source§

impl<T: BitStore> BitStore for Option<T>

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 1]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 2]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 3]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 4]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 5]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 6]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 7]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 8]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 9]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 10]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 11]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 12]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 13]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 14]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 15]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 16]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 17]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 18]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 19]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 20]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 21]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 22]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 23]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 24]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 25]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 26]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 27]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 28]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 29]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 30]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 31]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore> BitStore for [T; 32]

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Source§

impl<T: BitStore, F: BitStore> BitStore for Result<T, F>

Source§

fn read_from<R: BitRead>(reader: &mut R) -> Result<Self>

Source§

fn write_to<W: BitWrite>(&self, writer: &mut W) -> Result<()>

Implementors§