pub struct RangeWithLimit {
pub base: RangeInclusive<i32>,
pub user: Option<RangeInclusive<u32>>,
}Expand description
Holds a combination of ranges. Base range is defined in the base device config, user range is defined by the user later to be a sub-range of the base range. User range only stores in u32, ranges with negatives (i.e. rotate with direction) are considered to be symettric around 0, we let the system handle that conversion.
Fields§
§base: RangeInclusive<i32>§user: Option<RangeInclusive<u32>>Implementations§
Source§impl RangeWithLimit
impl RangeWithLimit
pub fn new(base: RangeInclusive<i32>) -> Self
pub fn new_with_user( base: RangeInclusive<i32>, user: Option<RangeInclusive<u32>>, ) -> Self
Sourcepub fn internal(&self) -> RangeInclusive<u32>
pub fn internal(&self) -> RangeInclusive<u32>
Returns the effective u32 range for calculations
pub fn step_limit(&self) -> RangeInclusive<i32>
pub fn step_count(&self) -> u32
pub fn try_new( base: RangeInclusive<i32>, user: Option<RangeInclusive<u32>>, ) -> Result<Self, ButtplugDeviceConfigError>
Trait Implementations§
Source§impl Clone for RangeWithLimit
impl Clone for RangeWithLimit
Source§impl Debug for RangeWithLimit
impl Debug for RangeWithLimit
Source§impl<'de> Deserialize<'de> for RangeWithLimit
impl<'de> Deserialize<'de> for RangeWithLimit
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
Source§impl From<RangeInclusive<i32>> for RangeWithLimit
impl From<RangeInclusive<i32>> for RangeWithLimit
Source§fn from(value: RangeInclusive<i32>) -> Self
fn from(value: RangeInclusive<i32>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Forget for RangeWithLimit
impl Freeze for RangeWithLimit
impl Move for RangeWithLimit
impl RefUnwindSafe for RangeWithLimit
impl Send for RangeWithLimit
impl Sync for RangeWithLimit
impl Unpin for RangeWithLimit
impl UnsafeUnpin for RangeWithLimit
impl UnwindSafe for RangeWithLimit
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