pub struct ReadOnly<T: Copy>(_);
Expand description

A volatile wrapper which only allows read operations.

The size of this struct is the same as the contained type.

Implementations

Construct a new read-only volatile wrapper wrapping the given value.

use volatile::ReadOnly;

let value = ReadOnly::new(42u32);
Panics

This function never panics.

Perform a volatile read of the contained value, returning a copy of the read value. Functionally equivalent to Volatile::read.

use volatile::ReadOnly;

let value = ReadOnly::new(42u32);
assert_eq!(value.read(), 42u32);
Panics

This function never panics.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.