Skip to main content

Edges

Struct Edges 

Source
#[repr(C)]
pub struct Edges<T> { pub top: T, pub right: T, pub bottom: T, pub left: T, }
Expand description

A value for each edge of a box: insets, paddings, borders.

Fields§

§top: T

The top edge.

§right: T

The right edge.

§bottom: T

The bottom edge.

§left: T

The left edge.

Implementations§

Source§

impl Edges<Length>

Source

pub fn auto() -> Edges<Length>

auto on every edge.

Source

pub fn zero() -> Edges<Length>

Zero on every edge.

Source§

impl Edges<DefiniteLength>

Source

pub fn zero() -> Edges<DefiniteLength>

Zero on every edge.

Source

pub fn to_points( self, parent_size: Size<AbsoluteLength>, rem_size: Points, ) -> Edges<Points>

In points: fractions of parent_size along each edge’s axis (the height for the top and bottom edges, as GPUI resolves them; CSS resolves a padding’s percentages against the width on every edge, which a parent_size of the width twice gives), rems of rem_size.

Source§

impl Edges<AbsoluteLength>

Source

pub fn zero() -> Edges<AbsoluteLength>

Zero on every edge.

Source

pub fn to_points(self, rem_size: Points) -> Edges<Points>

In points, with a rem of rem_size.

Source§

impl<T> Edges<T>
where T: Clone,

Source

pub fn all(value: T) -> Edges<T>

value on every edge.

Source

pub fn to_array(&self) -> [T; 4]

[top, right, bottom, left], for toolkits that take sides by index.

Source§

impl<T> Edges<T>

Source

pub fn map<U>(&self, f: impl Fn(&T) -> U) -> Edges<U>

Every edge converted by f.

Source

pub fn any(&self, predicate: impl Fn(&T) -> bool) -> bool

Whether predicate holds for any edge.

Source§

impl Edges<Points>

Source

pub fn zero() -> Edges<Points>

Zero on every edge.

Source

pub fn scale(&self, factor: f32) -> Edges<ScaledPixels>

Scaled to device pixels at factor (unrounded).

Source

pub fn max(&self) -> Points

The largest edge.

Trait Implementations§

Source§

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

Source§

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

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<T> Copy for Edges<T>
where T: Copy,

Source§

impl<T> Debug for Edges<T>
where T: Debug,

Source§

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

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

impl<T> Default for Edges<T>
where T: Default,

Source§

fn default() -> Edges<T>

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

impl<'de, T> Deserialize<'de> for Edges<T>
where T: Deserialize<'de>,

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Edges<T>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T> Eq for Edges<T>
where T: Eq,

Source§

impl From<Points> for Edges<Points>

Source§

fn from(p: Points) -> Edges<Points>

Converts to this type from the input type.
Source§

impl From<Rect<f32>> for Edges<Points>

Source§

fn from(r: Rect<f32>) -> Edges<Points>

Converts to this type from the input type.
Source§

impl<T> From<[T; 4]> for Edges<T>

Source§

fn from(_: [T; 4]) -> Edges<T>

From [top, right, bottom, left].

Source§

impl From<f32> for Edges<Points>

Source§

fn from(v: f32) -> Edges<Points>

Converts to this type from the input type.
Source§

impl<T> Hash for Edges<T>
where T: Hash,

Source§

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

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 HostValue for Edges<Points>

{ top, right, bottom, left } (each 0 when left out).

Source§

fn decode<I>(input: &I, _: &mut HostCx) -> Option<Edges<Points>>
where I: HostInput,

The value in input.
Source§

fn ts_type(_: &mut TsTypes) -> String

Its TypeScript type, declaring the named types it uses.
Source§

impl IntoReactive<Edges<Points>> for Edges<Points>

Source§

impl<T> IsZero for Edges<T>
where T: IsZero,

Source§

fn is_zero(&self) -> bool

Whether the value is zero.
Source§

impl JsValue for Edges<Points>

A length on each side, in points, as a host element’s hitSlop takes it (TS number | Partial<Edges>): one number for every side, or the sides named, each left out 0. A Rust component’s prop of the host prop’s meaning (Button’s hitSlop) takes the same values. To JS it is the four sides.

Source§

fn ts_type(_types: &mut TsTypes) -> String

Its TypeScript type (string, AlertButton), declaring the named types it uses in types.
Source§

fn from_js(value: JsIn<'_>) -> Result<Edges<Points>, PropError>

The value of JS value value.
Source§

fn to_js<'a>(&self, host: &'a dyn JsHost) -> Result<JsOwned<'a>, PropError>

The value as a JS value of host.
Source§

impl<T, S> Mul<S> for Edges<T>
where T: Mul<S, Output = T> + Clone, S: Clone,

Source§

type Output = Edges<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: S) -> Edges<T>

Performs the * operation. Read more
Source§

impl<T> PartialEq for Edges<T>
where T: PartialEq,

Source§

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

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

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

Inequality operator !=. Read more
Source§

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

Source§

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

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

impl<T> StructuralPartialEq for Edges<T>
where T: PartialEq,

Auto Trait Implementations§

§

impl<T> Forget for Edges<T>

§

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

§

impl<T> Move for Edges<T>

§

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

§

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

§

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

§

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

§

impl<T> UnsafeUnpin for Edges<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Edges<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> Arg for T
where T: JsValue,

Source§

fn ts_type(types: &mut TsTypes) -> String

Its TypeScript type.
Source§

fn from_js(value: JsIn<'_>) -> Result<T, PropError>

The value of a JS argument.
Source§

impl<T> AsOut<T> for T
where T: Copy,

Source§

fn as_out(&mut self) -> Out<'_, T>

Returns an out reference to self.
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> CallbackArgs for T
where T: Ret,

Source§

const ARITY: usize

How many there are.
Source§

fn ts_params(types: &mut TsTypes, names: &[&str]) -> String

Its TypeScript parameters, named names (name: string, amount: number), or without names value for one and a, b, … for several.
Source§

fn into_js_args<'a>( self, host: &'a dyn JsHost, ) -> Result<Vec<JsOwned<'a>>, PropError>

The arguments as JS values.
Source§

fn classes(out: &mut Vec<&'static ClassDef>)

Source§

impl<T> CallbackRet for T
where T: JsValue,

Source§

fn ts_type(types: &mut TsTypes) -> String

Its TypeScript type.
Source§

fn from_js(value: JsIn<'_>) -> Result<T, PropError>

The value the function returned.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ParallelSend for T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Ret for T
where T: JsValue,

Source§

fn ts_type(types: &mut TsTypes) -> String

Its TypeScript type.
Source§

fn into_js<'a>(self, host: &'a dyn JsHost) -> Result<JsOwned<'a>, PropError>

The value for JS.
Source§

const UNIT: bool = false

(): nothing (a callback taking it has no parameters).
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToJs for T
where T: Ret + 'static,

Source§

fn to_js_value<'a>( self: Box<T>, host: &'a dyn JsHost, ) -> Result<JsOwned<'a>, PropError>

The value as a JS value of host.
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 = !

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more