Skip to main content

IsolationWindowBuilder

Struct IsolationWindowBuilder 

Source
pub struct IsolationWindowBuilder<'a>(pub &'a mut IsolationWindow);
Expand description

A helper type that wraps an existing mutable reference to IsolationWindow that runs through a state machine updating fields depending upon the accumulated state of the isolation window.

If relative offsets are used, they will materialize +/- relative to Self::target. If the deprecated absolute limits are used, they are taken as-is. The relative and absolute APIs should not be mixed as the state machine does not track absolute/relative bounds independently.

use mzdata_spectrum::{IsolationWindow, IsolationWindowBuilder};

let mut state = IsolationWindow::default();
IsolationWindowBuilder(&mut state)
    .lower_offset(2.0)
    .upper_offset(3.0)
    .target(500.0);
assert_eq!(state.lower_bound, 498.0);
assert_eq!(state.upper_bound, 503.0);
assert_eq!(state.target, 500.0);

Tuple Fields§

§0: &'a mut IsolationWindow

Implementations§

Source§

impl<'a> IsolationWindowBuilder<'a>

Source

pub const fn flags(&self) -> IsolationWindowState

Get the current state of the isolation window

Source

pub const fn target(self, value: f32) -> Self

Set the target value

Source

pub const fn lower_offset(self, lower_bound: f32) -> Self

Set the lower offset relative to the Self::target

§Panics

If one of the bounds is already explicit and the target is not specified

Source

pub const fn upper_offset(self, upper_bound: f32) -> Self

Set the upper offset relative to the Self::target

§Panics

If one of the bounds is already explicit and the target is not specified

Source

pub const fn lower_limit(self, lower_bound: f32) -> Self

Set the explicit lower limit

Source

pub const fn upper_limit(self, upper_bound: f32) -> Self

Set the explicit upper limit

Source

pub const fn no_isolation(self) -> Self

Set no isolation, MSe/all ions fragmentation

Source

pub const fn is_complete(&self) -> bool

Check if the window is finished being configured

Source

pub const fn unit(self, unit: Unit) -> Self

Set the isolation window unit

Trait Implementations§

Source§

impl<'a> Debug for IsolationWindowBuilder<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.