pub struct ActiveSlot<A, M>{
pub attrs: A,
pub marks: M,
}Expand description
Convenience type for combining SlotAttributes and SlotMarkers,
or types which have the respective AsRef trait implemented.
This essentially gives you a type representative of the Octatrack’s slot editing pages
– all markers data and all attributes data.
Fields§
§attrs: A§marks: MImplementations§
Source§impl<A, M> ActiveSlot<A, M>
impl<A, M> ActiveSlot<A, M>
Sourcepub fn new(attrs: A, marks: M) -> Self
pub fn new(attrs: A, marks: M) -> Self
Creates a new ActiveSlot instance from the two component slots data types.
§AsRef
This method accepts any input type where, for each respective argument,
AsRef<SlotSlotAttributes> or AsRef<SlotSlotMarkers> has been implemented appropriately.
Therefore, any type that can be AsRef’d into one of these types is accepted as the
relevant argument.
§SlotAttributes example
use ot_tools_io::types::ActiveSlot;
use ot_tools_io::types::SlotAttributes;
use ot_tools_io::types::SlotMarkers;
// example data
let attrs = SlotAttributes {
slot_type: SlotType::Static,
slot_id: 1,
path: None,
timestrech_mode: Default::default(),
loop_mode: Default::default(),
trig_quantization_mode: Default::default(),
gain: 48,
bpm: 2880
};
pub struct AttrsNewType(SlotAttributes);
impl AsRef<SlotAttributes> for AttrsNewType {
fn as_ref(&self) -> &SlotAttributes {
&self.0
}
}
ActiveSlot::new(AttrsNewType(attrs), SlotMarkers::default());§SlotMarkers example
use ot_tools_io::types::SlotMarkers;
use ot_tools_io::types::ActiveSlot;
let marks = SlotMarkers::default();
pub struct MarksNewType(SlotMarkers);
impl AsRef<SlotMarkers> for MarksNewType {
fn as_ref(&self) -> &SlotMarkers {
&self.0
}
}
// can use the type as an input here
ActiveSlot::new(attrs, MarksNewType(marks));pub fn attrs_ref(&self) -> &A
Source§impl<A, M> ActiveSlot<A, M>
impl<A, M> ActiveSlot<A, M>
Trait Implementations§
Source§impl AsRef<ActiveSlot<SlotAttributes, SlotMarkers>> for ActiveSlot<SlotAttributes, SlotMarkers>
impl AsRef<ActiveSlot<SlotAttributes, SlotMarkers>> for ActiveSlot<SlotAttributes, SlotMarkers>
Source§fn as_ref(&self) -> &ActiveSlot<SlotAttributes, SlotMarkers>
fn as_ref(&self) -> &ActiveSlot<SlotAttributes, SlotMarkers>
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<A, M> Clone for ActiveSlot<A, M>
impl<A, M> Clone for ActiveSlot<A, M>
Source§fn clone(&self) -> ActiveSlot<A, M>
fn clone(&self) -> ActiveSlot<A, M>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<A, M> Copy for ActiveSlot<A, M>
Source§impl<A, M> Debug for ActiveSlot<A, M>
impl<A, M> Debug for ActiveSlot<A, M>
Source§impl<A, M> Default for ActiveSlot<A, M>
impl<A, M> Default for ActiveSlot<A, M>
Source§fn default() -> ActiveSlot<A, M>
fn default() -> ActiveSlot<A, M>
Returns the “default value” for a type. Read more
impl<A, M> Eq for ActiveSlot<A, M>
Source§impl<A, M> From<ActiveSlot<A, M>> for SampleSettingsFile
impl<A, M> From<ActiveSlot<A, M>> for SampleSettingsFile
Source§fn from(value: ActiveSlot<A, M>) -> Self
fn from(value: ActiveSlot<A, M>) -> Self
Converts to this type from the input type.
Source§impl<A, M> Hash for ActiveSlot<A, M>
impl<A, M> Hash for ActiveSlot<A, M>
Source§impl<A, M> Ord for ActiveSlot<A, M>
impl<A, M> Ord for ActiveSlot<A, M>
Source§fn cmp(&self, other: &ActiveSlot<A, M>) -> Ordering
fn cmp(&self, other: &ActiveSlot<A, M>) -> Ordering
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<A, M> PartialEq for ActiveSlot<A, M>
impl<A, M> PartialEq for ActiveSlot<A, M>
Source§impl<A, M> PartialOrd for ActiveSlot<A, M>
impl<A, M> PartialOrd for ActiveSlot<A, M>
impl<A, M> StructuralPartialEq for ActiveSlot<A, M>
Auto Trait Implementations§
impl<A, M> Freeze for ActiveSlot<A, M>
impl<A, M> RefUnwindSafe for ActiveSlot<A, M>where
A: RefUnwindSafe,
M: RefUnwindSafe,
impl<A, M> Send for ActiveSlot<A, M>
impl<A, M> Sync for ActiveSlot<A, M>
impl<A, M> Unpin for ActiveSlot<A, M>
impl<A, M> UnsafeUnpin for ActiveSlot<A, M>where
A: UnsafeUnpin,
M: UnsafeUnpin,
impl<A, M> UnwindSafe for ActiveSlot<A, M>where
A: UnwindSafe,
M: 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
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