pub trait FromCharacteristic: Sized {
const UUID: Uuid;
// Required methods
fn from_chr(
characteristic: Characteristic,
value: &[u8],
) -> Result<Self, Error>;
fn update(&mut self, new_value: &[u8]) -> Result<&mut Self, Error>;
// Provided method
fn try_read<T: GattTypes>(
characteristic: Characteristic,
service: &T::PeerService,
) -> impl Future<Output = Result<Self, Error>> { ... }
}
Expand description
Implement when a type can be deserialized from a characteristic value.
Required Associated Constants§
Required Methods§
Provided Methods§
Sourcefn try_read<T: GattTypes>(
characteristic: Characteristic,
service: &T::PeerService,
) -> impl Future<Output = Result<Self, Error>>
fn try_read<T: GattTypes>( characteristic: Characteristic, service: &T::PeerService, ) -> impl Future<Output = Result<Self, Error>>
Attempt to read a characteristic if it matches the provided characteristic UUID.
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.