Struct Alignment

Source
pub struct Alignment<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Alignment<'a>

Source

pub fn from_raw(alignment: *mut PedAlignment) -> Alignment<'a>

Source

pub fn new(offset: i64, grain_size: i64) -> Result<Alignment<'a>>

Return an alignment object representing all sectors that are of the form offset + X * grain_size.

Source

pub fn init(&mut self, offset: i64, grain_size: i64) -> Result<()>

Initializes a preallocated piece of memory for an alignment object.

The object will represent all sectors for which the equation S = offset + x * grain_size holds.

Source

pub fn align_down(&self, geom: &Geometry<'_>, sector: i64) -> Option<u64>

Returns the sector that is closest to sector, satifies the align constraint, and lies lies inside geom.

Source

pub fn align_nearest(&self, geom: &Geometry<'_>, sector: i64) -> Option<u64>

Returns the sector that is closest to sector, satisfies the align constraint, and lies inside of geom.

Source

pub fn align_up(&self, geom: &Geometry<'_>, sector: i64) -> Option<u64>

Returns the sector that is closest to sector, satifies the align constraint, and lies lies inside geom.

Source

pub fn duplicate<'b>(&self) -> Result<Alignment<'b>>

Clones and returns a duplicate of the alignment, if possible.

Source

pub fn grain_size(&self) -> i64

Source

pub fn intersect(&self, other: &Alignment<'_>) -> Option<Alignment<'a>>

Returns a new Alignment object if an intersection can between itself and a given other Alignment.

Source

pub fn is_aligned(&self, geom: &Geometry<'_>, sector: i64) -> bool

Returns the sector that is closest to sector, satifies the align constraint, and lies lies inside geom.

Source

pub fn offset(&self) -> i64

Trait Implementations§

Source§

impl<'a> Drop for Alignment<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Alignment<'a>

§

impl<'a> RefUnwindSafe for Alignment<'a>

§

impl<'a> !Send for Alignment<'a>

§

impl<'a> !Sync for Alignment<'a>

§

impl<'a> Unpin for Alignment<'a>

§

impl<'a> UnwindSafe for Alignment<'a>

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 = 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.