write_only/
reference.rs

1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
5//! References that only provide write-access, no read.
6
7mod non_volatile;
8mod volatile;
9
10pub use non_volatile::WriteOnlyRef;
11pub use volatile::VolatileWriteOnlyRef;
12
13/// A trait for objects which provide **dropping** write access to their value.
14pub trait Put<T> {
15    /// Puts the value the given value, dropping the old value.
16    fn put(&mut self, value: T);
17}
18
19/// A trait for objects which provide **non-dropping** write access to their value.
20pub trait Write<T> {
21    /// Writes the value the given value without dropping the old value.
22    fn write(&mut self, value: T);
23}