Skip to main content

ActiveSlot

Struct ActiveSlot 

Source
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: M

Implementations§

Source§

impl<A, M> ActiveSlot<A, M>

Source

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));
Source

pub fn attrs(self) -> A

getter for attributes data

Source

pub fn attrs_ref(&self) -> &A

Source

pub fn marks(self) -> M

reference getter for markers data

Source

pub fn marks_ref(&self) -> &M

reference getter for markers data

Source§

impl<A, M> ActiveSlot<A, M>

Source

pub fn attrs_mut(&mut self) -> &mut A

mutable reference getter for attributes data

Source

pub fn marks_mut(&mut self) -> &mut M

mutable reference getter for markers data

Trait Implementations§

Source§

impl AsRef<ActiveSlot<SlotAttributes, SlotMarkers>> for ActiveSlot<SlotAttributes, SlotMarkers>

Source§

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>

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<A, M> Copy for ActiveSlot<A, M>

Source§

impl<A, M> Debug for ActiveSlot<A, M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A, M> Default for ActiveSlot<A, M>

Source§

fn default() -> ActiveSlot<A, M>

Returns the “default value” for a type. Read more
Source§

impl<A, M> Eq for ActiveSlot<A, M>

Source§

impl<A, M> From<ActiveSlot<A, M>> for SampleSettingsFile

Source§

fn from(value: ActiveSlot<A, M>) -> Self

Converts to this type from the input type.
Source§

impl<A, M> Hash for ActiveSlot<A, M>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<A, M> Ord for ActiveSlot<A, M>

Source§

fn cmp(&self, other: &ActiveSlot<A, M>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<A, M> PartialEq for ActiveSlot<A, M>

Source§

fn eq(&self, other: &ActiveSlot<A, M>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<A, M> PartialOrd for ActiveSlot<A, M>

Source§

fn partial_cmp(&self, other: &ActiveSlot<A, M>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<A, M> StructuralPartialEq for ActiveSlot<A, M>

Auto Trait Implementations§

§

impl<A, M> Freeze for ActiveSlot<A, M>
where A: Freeze, M: Freeze,

§

impl<A, M> RefUnwindSafe for ActiveSlot<A, M>

§

impl<A, M> Send for ActiveSlot<A, M>
where A: Send, M: Send,

§

impl<A, M> Sync for ActiveSlot<A, M>
where A: Sync, M: Sync,

§

impl<A, M> Unpin for ActiveSlot<A, M>
where A: Unpin, M: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.