Crate write_only[][src]

Expand description

References/slices that provide write-access, but no read-access.

Examples

Write-only reference:

use write_only::{prelude::*, Put};

fn write<T: Put<u8>>(write_only: &mut T) {
    write_only.put(42u8);
}

let mut value: u8 = 0;

let mut write_only = WriteOnlyRef::from(&mut value);
write(&mut write_only);

assert_eq!(value, 42);

Write-only slice:

use write_only::{prelude::*, PutAt};

fn write<T: PutAt<u8>>(write_only: &mut T) {
    write_only.put_at(2, 42u8);
}

let mut values: Vec<u8> = (0..10).collect();

let mut write_only = WriteOnlySlice::from(&mut values[..]);
write(&mut write_only);

assert_eq!(values[2], 42u8);

Modules

The crate’s prelude.

Structs

A write-only reference with non-dropping volatile write access.

A write-only slice with non-dropping volatile write access.

A write-only reference with dropping non-volatile write access.

A write-only slice with dropping non-volatile write access.

Traits

A trait for objects which provide dropping write access to their value.

A trait for objects which provide dropping indexed write access to their values.

A trait for objects which provide dropping indexed write access to their values from a slice.

A trait for objects which provide non-dropping write access to their value.

A trait for objects which provide non-dropping indexed write access to their values.

A trait for objects which provide non-dropping indexed write access to their values from a slice.