[−][src]Struct spectrusty_core::bus::DynamicSerdeBus
A wrapper for DynamicBus that is able to serialize and deserialize together with currently attached dynamic devices.
Use this type instead of DynamicBus when specifying crate::chip::ControlUnit::BusDevice or BusDevice::NextDevice.
A type that implements SerializeDynDevice and DeserializeDynDevice must be declared as
generic parameter S
.
Methods from Deref<Target = DynamicBus<D>>
pub fn len(&self) -> usize
[src]
Returns the number of attached devices.
pub fn is_empty(&self) -> bool
[src]
Returns true
if there are no devices in the dynamic chain. Otherwise returns false
.
pub fn append_device<B>(&mut self, device: B) -> usize where
B: Into<BoxNamedDynDevice<D::Timestamp>>,
[src]
B: Into<BoxNamedDynDevice<D::Timestamp>>,
Appends an instance of a device
at the end of the daisy-chain.
Returns its index position in the dynamic device chain.
pub fn remove_device(&mut self) -> Option<BoxNamedDynDevice<D::Timestamp>>
[src]
Removes the last device from the dynamic daisy-chain and returns an instance of the boxed dynamic object.
pub fn swap_remove_device(
&mut self,
index: usize
) -> BoxNamedDynDevice<D::Timestamp>
[src]
&mut self,
index: usize
) -> BoxNamedDynDevice<D::Timestamp>
Replaces a device at the given index
position and returns it.
The removed device is replaced by the last device of the chain.
Panics
Panics if a device doesn't exist at index
.
pub fn replace_device<B>(
&mut self,
index: usize,
device: B
) -> BoxNamedDynDevice<D::Timestamp> where
B: Into<BoxNamedDynDevice<D::Timestamp>>,
[src]
&mut self,
index: usize,
device: B
) -> BoxNamedDynDevice<D::Timestamp> where
B: Into<BoxNamedDynDevice<D::Timestamp>>,
Replaces a device at the given index
position. Returns the previous device occupying the replaced spot.
Panics
Panics if a device doesn't exist at index
.
pub fn clear(&mut self)
[src]
Removes all dynamic devices from the dynamic daisy-chain.
pub fn get_device_ref(
&self,
index: usize
) -> Option<&NamedDynDevice<D::Timestamp>>
[src]
&self,
index: usize
) -> Option<&NamedDynDevice<D::Timestamp>>
Returns a reference to a dynamic device at index
position in the dynamic daisy-chain.
pub fn get_device_mut(
&mut self,
index: usize
) -> Option<&mut NamedDynDevice<D::Timestamp>>
[src]
&mut self,
index: usize
) -> Option<&mut NamedDynDevice<D::Timestamp>>
Returns a mutable reference to a dynamic device at index
position in the dynamic daisy-chain.
pub fn remove_as_device<B>(&mut self) -> Option<Box<B>> where
B: NamedBusDevice<D::Timestamp> + 'static,
[src]
B: NamedBusDevice<D::Timestamp> + 'static,
Removes the last device from the dynamic daisy-chain.
Panics
Panics if a device is not of a type given as parameter B
.
pub fn swap_remove_as_device<B>(&mut self, index: usize) -> Box<B> where
B: NamedBusDevice<D::Timestamp> + 'static,
[src]
B: NamedBusDevice<D::Timestamp> + 'static,
Replaces a device at the given index
and returns it.
The removed device is replaced by the last device of the chain.
Panics
Panics if a device doesn't exist at index
or if a device is not of a type given as parameter B
.
pub fn as_device_ref<B>(&self, index: usize) -> &B where
B: NamedBusDevice<D::Timestamp> + 'static,
[src]
B: NamedBusDevice<D::Timestamp> + 'static,
Returns a reference to a device of a type B
at index
in the dynamic daisy-chain.
Panics
Panics if a device doesn't exist at index
or if a device is not of a type given as parameter B
.
pub fn as_device_mut<B>(&mut self, index: usize) -> &mut B where
B: NamedBusDevice<D::Timestamp> + 'static,
[src]
B: NamedBusDevice<D::Timestamp> + 'static,
Returns a mutable reference to a device of a type B
at index
in the dynamic daisy-chain.
Panics
Panics if a device doesn't exist at index
or if a device is not of a type given as parameter B
.
pub fn is_device<B>(&self, index: usize) -> bool where
B: NamedBusDevice<D::Timestamp> + 'static,
[src]
B: NamedBusDevice<D::Timestamp> + 'static,
Returns true
if a device at index
is of a type given as parameter B
.
pub fn position_device<B>(&self) -> Option<usize> where
B: NamedBusDevice<D::Timestamp> + 'static,
[src]
B: NamedBusDevice<D::Timestamp> + 'static,
Searches for a first device of a type given as parameter B
, returning its index.
pub fn find_device_ref<B>(&self) -> Option<&B> where
B: NamedBusDevice<D::Timestamp> + 'static,
[src]
B: NamedBusDevice<D::Timestamp> + 'static,
Searches for a first device of a type given as parameter B
, returning a reference to a device.
pub fn find_device_mut<B>(&mut self) -> Option<&mut B> where
B: NamedBusDevice<D::Timestamp> + 'static,
[src]
B: NamedBusDevice<D::Timestamp> + 'static,
Searches for a first device of a type given as parameter B
, returning a mutable reference to a device.
Trait Implementations
impl<S, D: BusDevice> BusDevice for DynamicSerdeBus<S, D> where
D: BusDevice,
D::Timestamp: Copy + Debug,
[src]
D: BusDevice,
D::Timestamp: Copy + Debug,
type Timestamp = D::Timestamp
A type used as a time-stamp.
type NextDevice = D
A type of the next device in a daisy chain.
pub fn next_device_mut(&mut self) -> &mut Self::NextDevice
[src]
pub fn next_device_ref(&self) -> &Self::NextDevice
[src]
pub fn into_next_device(self) -> Self::NextDevice
[src]
pub fn reset(&mut self, timestamp: Self::Timestamp)
[src]
pub fn update_timestamp(&mut self, timestamp: Self::Timestamp)
[src]
pub fn next_frame(&mut self, timestamp: Self::Timestamp)
[src]
pub fn read_io(
&mut self,
port: u16,
timestamp: Self::Timestamp
) -> Option<(u8, Option<NonZeroU16>)>
[src]
&mut self,
port: u16,
timestamp: Self::Timestamp
) -> Option<(u8, Option<NonZeroU16>)>
pub fn write_io(
&mut self,
port: u16,
data: u8,
timestamp: Self::Timestamp
) -> Option<u16>
[src]
&mut self,
port: u16,
data: u8,
timestamp: Self::Timestamp
) -> Option<u16>
pub fn type_id(&self) -> TypeId where
Self: 'static,
[src]
Self: 'static,
impl<S, D> Debug for DynamicSerdeBus<S, D> where
D: BusDevice + Debug,
D::Timestamp: Debug,
[src]
D: BusDevice + Debug,
D::Timestamp: Debug,
impl<S, D> Default for DynamicSerdeBus<S, D> where
D: BusDevice + Default,
D::Timestamp: Default,
[src]
D: BusDevice + Default,
D::Timestamp: Default,
impl<S, D: BusDevice> Deref for DynamicSerdeBus<S, D>
[src]
type Target = DynamicBus<D>
The resulting type after dereferencing.
pub fn deref(&self) -> &Self::Target
[src]
impl<S, D: BusDevice> DerefMut for DynamicSerdeBus<S, D>
[src]
impl<'de, DDD, B> Deserialize<'de> for DynamicSerdeBus<DDD, B> where
DDD: DeserializeDynDevice<'de> + 'de,
B: BusDevice + Deserialize<'de> + Default,
B::Timestamp: Default + TimestampOps + Deserialize<'de> + 'static,
[src]
DDD: DeserializeDynDevice<'de> + 'de,
B: BusDevice + Deserialize<'de> + Default,
B::Timestamp: Default + TimestampOps + Deserialize<'de> + 'static,
pub fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> Result<Self, D::Error>
[src]
deserializer: D
) -> Result<Self, D::Error>
impl<S, D: BusDevice> From<DynamicBus<D>> for DynamicSerdeBus<S, D>
[src]
pub fn from(dynamic_bus: DynamicBus<D>) -> Self
[src]
impl<S, D: BusDevice> From<DynamicSerdeBus<S, D>> for DynamicBus<D>
[src]
pub fn from(dynamic_bus: DynamicSerdeBus<S, D>) -> Self
[src]
impl<SDD, B> Serialize for DynamicSerdeBus<SDD, B> where
SDD: SerializeDynDevice,
B: BusDevice + Serialize,
B::Timestamp: TimestampOps + Serialize + 'static,
[src]
SDD: SerializeDynDevice,
B: BusDevice + Serialize,
B::Timestamp: TimestampOps + Serialize + 'static,
Auto Trait Implementations
impl<S, D> !RefUnwindSafe for DynamicSerdeBus<S, D>
[src]
impl<S, D> !Send for DynamicSerdeBus<S, D>
[src]
impl<S, D> !Sync for DynamicSerdeBus<S, D>
[src]
impl<S, D> Unpin for DynamicSerdeBus<S, D> where
D: Unpin,
S: Unpin,
[src]
D: Unpin,
S: Unpin,
impl<S, D> !UnwindSafe for DynamicSerdeBus<S, D>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,