pub struct CharacteristicAggregateFormat {
pub list_of_attribute_handles: Vec<u16>,
}
Expand description
Characteristic Aggregate Format.
Fields§
§list_of_attribute_handles: Vec<u16>
List of Attribute Handles
Implementations§
Source§impl CharacteristicAggregateFormat
impl CharacteristicAggregateFormat
Sourcepub fn new(list_of_attribute_handles: &Vec<u16>) -> Self
pub fn new(list_of_attribute_handles: &Vec<u16>) -> Self
Create CharacteristicAggregateFormat
from String
.
§Examples
use ble_data_struct::{
descriptors::characteristic_aggregate_format::CharacteristicAggregateFormat, Uuid16bit,
};
let list_of_attribute_handles: Vec<u16> = [0x0201, 0x0403].to_vec();
let result = CharacteristicAggregateFormat::new(&list_of_attribute_handles.clone());
assert_eq!(list_of_attribute_handles, result.list_of_attribute_handles);
Trait Implementations§
Source§impl Clone for CharacteristicAggregateFormat
impl Clone for CharacteristicAggregateFormat
Source§fn clone(&self) -> CharacteristicAggregateFormat
fn clone(&self) -> CharacteristicAggregateFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Into<Vec<u8>> for CharacteristicAggregateFormat
impl Into<Vec<u8>> for CharacteristicAggregateFormat
Source§fn into(self) -> Vec<u8> ⓘ
fn into(self) -> Vec<u8> ⓘ
Create Vec<u8>
from CharacteristicAggregateFormat
.
§Examples
use ble_data_struct::{
descriptors::characteristic_aggregate_format::CharacteristicAggregateFormat, Uuid16bit,
};
let list_of_attribute_handles: Vec<u16> = [0x0201, 0x0403].to_vec();
let result = CharacteristicAggregateFormat::new(&list_of_attribute_handles.clone());
let data: Vec<u8> = list_of_attribute_handles
.clone()
.iter()
.flat_map(|f| f.to_le_bytes())
.collect();
let into_data: Vec<u8> = result.into();
assert_eq!(data, into_data);
Source§impl PartialEq for CharacteristicAggregateFormat
impl PartialEq for CharacteristicAggregateFormat
Source§fn eq(&self, other: &CharacteristicAggregateFormat) -> bool
fn eq(&self, other: &CharacteristicAggregateFormat) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.Source§impl TryFrom<&Vec<u8>> for CharacteristicAggregateFormat
impl TryFrom<&Vec<u8>> for CharacteristicAggregateFormat
Source§fn try_from(value: &Vec<u8>) -> Result<Self, String>
fn try_from(value: &Vec<u8>) -> Result<Self, String>
Create CharacteristicAggregateFormat
from Vec<u8>
.
§Examples
use ble_data_struct::{
descriptors::characteristic_aggregate_format::CharacteristicAggregateFormat, Uuid16bit,
};
let list_of_attribute_handles: Vec<u16> = [0x0201, 0x0403].to_vec();
let data: Vec<u8> = list_of_attribute_handles
.clone()
.iter()
.flat_map(|f| f.to_le_bytes())
.collect();
let result = CharacteristicAggregateFormat::try_from(&data);
assert!(result.is_ok());
let descriptor = result.unwrap();
assert_eq!(
list_of_attribute_handles,
descriptor.list_of_attribute_handles
);
let result = CharacteristicAggregateFormat::try_from(&Vec::new());
assert!(!result.is_ok());
let result = CharacteristicAggregateFormat::try_from(&vec![0, 1, 2]);
assert!(!result.is_ok());
Source§impl Uuid16bit for CharacteristicAggregateFormat
impl Uuid16bit for CharacteristicAggregateFormat
Source§fn uuid_16bit() -> u16
fn uuid_16bit() -> u16
return 0x2905
.
§Examples
use ble_data_struct::{
descriptors::characteristic_aggregate_format::CharacteristicAggregateFormat, Uuid16bit,
};
assert_eq!(0x2905, CharacteristicAggregateFormat::uuid_16bit());
impl StructuralPartialEq for CharacteristicAggregateFormat
Auto Trait Implementations§
impl Freeze for CharacteristicAggregateFormat
impl RefUnwindSafe for CharacteristicAggregateFormat
impl Send for CharacteristicAggregateFormat
impl Sync for CharacteristicAggregateFormat
impl Unpin for CharacteristicAggregateFormat
impl UnwindSafe for CharacteristicAggregateFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more