Struct style::logical_geometry::LogicalMargin

source ·
pub struct LogicalMargin<T> {
    pub block_start: T,
    pub inline_end: T,
    pub block_end: T,
    pub inline_start: T,
    debug_writing_mode: DebugWritingMode,
}
Expand description

A “margin” in flow-relative dimensions Represents the four sides of the margins, borders, or padding of a CSS box, or a combination of those. A positive “margin” can be added to a rectangle to obtain a bigger rectangle.

Fields§

§block_start: T§inline_end: T§block_end: T§inline_start: T§debug_writing_mode: DebugWritingMode

Implementations§

source§

impl<T: Zero> LogicalMargin<T>

source§

impl<T> LogicalMargin<T>

source

pub fn new( mode: WritingMode, block_start: T, inline_end: T, block_end: T, inline_start: T, ) -> LogicalMargin<T>

source

pub fn from_physical( mode: WritingMode, offsets: SideOffsets2D<T>, ) -> LogicalMargin<T>

source§

impl<T: Clone> LogicalMargin<T>

source

pub fn new_all_same(mode: WritingMode, value: T) -> LogicalMargin<T>

source

pub fn top(&self, mode: WritingMode) -> T

source

pub fn set_top(&mut self, mode: WritingMode, top: T)

source

pub fn right(&self, mode: WritingMode) -> T

source

pub fn set_right(&mut self, mode: WritingMode, right: T)

source

pub fn bottom(&self, mode: WritingMode) -> T

source

pub fn set_bottom(&mut self, mode: WritingMode, bottom: T)

source

pub fn left(&self, mode: WritingMode) -> T

source

pub fn set_left(&mut self, mode: WritingMode, left: T)

source

pub fn to_physical(&self, mode: WritingMode) -> SideOffsets2D<T>

source

pub fn convert( &self, mode_from: WritingMode, mode_to: WritingMode, ) -> LogicalMargin<T>

source§

impl<T: PartialEq + Zero> LogicalMargin<T>

source

pub fn is_zero(&self) -> bool

source§

impl<T: Copy + Add<T, Output = T>> LogicalMargin<T>

source

pub fn inline_start_end(&self) -> T

source

pub fn block_start_end(&self) -> T

source

pub fn start_end(&self, direction: Direction) -> T

source

pub fn top_bottom(&self, mode: WritingMode) -> T

source

pub fn left_right(&self, mode: WritingMode) -> T

Trait Implementations§

source§

impl<T: Copy + Add<T, Output = T> + Sub<T, Output = T>> Add<LogicalMargin<T>> for LogicalRect<T>

§

type Output = LogicalRect<T>

The resulting type after applying the + operator.
source§

fn add(self, other: LogicalMargin<T>) -> LogicalRect<T>

Performs the + operation. Read more
source§

impl<T: Add<T, Output = T>> Add for LogicalMargin<T>

§

type Output = LogicalMargin<T>

The resulting type after applying the + operator.
source§

fn add(self, other: LogicalMargin<T>) -> LogicalMargin<T>

Performs the + operation. Read more
source§

impl<T: Clone> Clone for LogicalMargin<T>

source§

fn clone(&self) -> LogicalMargin<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for LogicalMargin<T>

source§

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

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

impl<T: PartialEq> PartialEq for LogicalMargin<T>

source§

fn eq(&self, other: &LogicalMargin<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Serialize for LogicalMargin<T>
where T: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: Copy + Add<T, Output = T> + Sub<T, Output = T>> Sub<LogicalMargin<T>> for LogicalRect<T>

§

type Output = LogicalRect<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: LogicalMargin<T>) -> LogicalRect<T>

Performs the - operation. Read more
source§

impl<T: Sub<T, Output = T>> Sub for LogicalMargin<T>

§

type Output = LogicalMargin<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: LogicalMargin<T>) -> LogicalMargin<T>

Performs the - operation. Read more
source§

impl<T: Copy> Copy for LogicalMargin<T>

source§

impl<T: Eq> Eq for LogicalMargin<T>

source§

impl<T> StructuralPartialEq for LogicalMargin<T>

Auto Trait Implementations§

§

impl<T> Freeze for LogicalMargin<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for LogicalMargin<T>
where T: RefUnwindSafe,

§

impl<T> Send for LogicalMargin<T>
where T: Send,

§

impl<T> Sync for LogicalMargin<T>
where T: Sync,

§

impl<T> Unpin for LogicalMargin<T>
where T: Unpin,

§

impl<T> UnwindSafe for LogicalMargin<T>
where T: 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<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> MaybeBoxed<Box<T>> for T

source§

fn maybe_boxed(self) -> Box<T>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T