pub struct Trigs<T>(/* private fields */);Expand description
Generic collection for data related to trigs.
Used in Patterns with parameter lock trig assignments and trig offset/repeat/conditions data.
§Box (no-Copy)
Unfortunately serde requires that we wrap the inner array type of Trigs in a Box.
As a result, Trigs and any type that contains a Trigs type cannot implement the Copy trait.
§Example: Using in your own code with custom inner types
use ot_tools_io::types::Trigs;
use ot_tools_io::Defaults;
use ot_tools_io_derive::{ArrayDefaults, BoxedArrayDefaults};
use std::array::from_fn;
#[derive(Debug, PartialEq, Default, ArrayDefaults, BoxedArrayDefaults)]
pub struct SomeNumber(u8);
fn main() -> Result<(), ()> {
let mut my_trigs = Trigs::<SomeNumber>::default();
let first = my_trigs.first_mut().ok_or(())?;
*first = SomeNumber(100);
// first one changed
assert_eq!(my_trigs[0], SomeNumber(100));
// rest are default
assert_eq!(my_trigs[1], SomeNumber(0));
// correct length
assert_eq!(my_trigs.len(), 64);
Ok(())
}Implementations§
Source§impl<T> Trigs<T>
impl<T> Trigs<T>
Trait Implementations§
Source§impl<'de, T: Deserialize<'de>> Deserialize<'de> for Trigs<T>
impl<'de, T: Deserialize<'de>> Deserialize<'de> for Trigs<T>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<T: Eq> Eq for Trigs<T>
Source§impl<T: Ord> Ord for Trigs<T>
impl<T: Ord> Ord for Trigs<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd> PartialOrd for Trigs<T>
impl<T: PartialOrd> PartialOrd for Trigs<T>
impl<T: PartialEq> StructuralPartialEq for Trigs<T>
Auto Trait Implementations§
impl<T> Freeze for Trigs<T>
impl<T> RefUnwindSafe for Trigs<T>where
T: RefUnwindSafe,
impl<T> Send for Trigs<T>where
T: Send,
impl<T> Sync for Trigs<T>where
T: Sync,
impl<T> Unpin for Trigs<T>
impl<T> UnsafeUnpin for Trigs<T>
impl<T> UnwindSafe for Trigs<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more