pub struct Edge { /* private fields */ }
Expand description

An edge of a rectangle.

Implementations§

source§

impl Edge

source

pub fn new(side: Side, coord: i64, span: Span) -> Edge

Create a new edge.

§Example
let edge = Edge::new(Side::Left, 20, Span::new(40, 100));
source

pub fn side(&self) -> Side

The side (of a rectangle) to which this edge corresponds.

§Example
let edge = Edge::new(Side::Left, 20, Span::new(40, 100));
assert_eq!(edge.side(), Side::Left);
source

pub fn coord(&self) -> i64

The coordinate of the edge.

For left/right edges, this will be the x coordinate of the edge. For top/bottom edges, this will be the y coordinate of the edge.

§Example
let edge = Edge::new(Side::Left, 20, Span::new(40, 100));
assert_eq!(edge.coord(), 20);
source

pub fn span(&self) -> Span

The span of the edge.

For left/right edges, this will be the range of y-coordinates encompassed by the edge. For top/bottom edges, this will be the range of x-coordinates encompassed by the edge.

§Example
let edge = Edge::new(Side::Left, 20, Span::new(40, 100));
assert_eq!(edge.span(), Span::new(40, 100));
source

pub fn with_span(&self, span: Span) -> Edge

Returns an Edge with the same properties as the provided Edge but with a new span.

§Example
let edge = Edge::new(Side::Left, 20, Span::new(40, 100));
assert_eq!(edge.span(), Span::new(40, 100));
let edge_new = edge.with_span(Span::new(20, 100));
assert_eq!(edge_new.span(), Span::new(20, 100));
source

pub fn norm_dir(&self) -> Dir

The direction perpendicular to the edge.

For left/right edges, this will be Dir::Horiz. For top/bottom edges, this will be Dir::Vert.

§Example
let edge = Edge::new(Side::Left, 20, Span::new(40, 100));
assert_eq!(edge.norm_dir(), Dir::Horiz);
let edge = Edge::new(Side::Right, 20, Span::new(40, 100));
assert_eq!(edge.norm_dir(), Dir::Horiz);
let edge = Edge::new(Side::Top, 20, Span::new(40, 100));
assert_eq!(edge.norm_dir(), Dir::Vert);
let edge = Edge::new(Side::Bot, 20, Span::new(40, 100));
assert_eq!(edge.norm_dir(), Dir::Vert);
source

pub fn edge_dir(&self) -> Dir

The direction parallel to the edge.

For left/right edges, this will be Dir::Vert. For top/bottom edges, this will be Dir::Horiz.

§Example
let edge = Edge::new(Side::Left, 20, Span::new(40, 100));
assert_eq!(edge.edge_dir(), Dir::Vert);
let edge = Edge::new(Side::Right, 20, Span::new(40, 100));
assert_eq!(edge.edge_dir(), Dir::Vert);
let edge = Edge::new(Side::Top, 20, Span::new(40, 100));
assert_eq!(edge.edge_dir(), Dir::Horiz);
let edge = Edge::new(Side::Bot, 20, Span::new(40, 100));
assert_eq!(edge.edge_dir(), Dir::Horiz);
source

pub fn offset(&self, offset: i64) -> Edge

Returns a new Edge offset some amount away from this edge.

Left edges will be offset to the left; right edges will be offset to the right. Top edges will be offset upwards; bottom edges will be offset downwards.

§Example
let edge = Edge::new(Side::Left, 20, Span::new(40, 100));
assert_eq!(edge.offset(10), Edge::new(Side::Left, 10, Span::new(40, 100)));

let edge = Edge::new(Side::Top, 20, Span::new(40, 100));
assert_eq!(edge.offset(10), Edge::new(Side::Top, 30, Span::new(40, 100)));

Trait Implementations§

source§

impl Clone for Edge

source§

fn clone(&self) -> Edge

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 Debug for Edge

source§

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

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

impl<'de> Deserialize<'de> for Edge

source§

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

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

impl Hash for Edge

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 PartialEq for Edge

source§

fn eq(&self, other: &Edge) -> 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 Serialize for Edge

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 Copy for Edge

source§

impl Eq for Edge

source§

impl StructuralPartialEq for Edge

Auto Trait Implementations§

§

impl RefUnwindSafe for Edge

§

impl Send for Edge

§

impl Sync for Edge

§

impl Unpin for Edge

§

impl UnwindSafe for Edge

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, U> CustomHardwareType<Flipped<T>> for U

source§

fn from_layout_type(other: &Flipped<T>) -> U

Creates this layout type from another layout type.
source§

impl<T, U> CustomHardwareType<InOut<T>> for U

source§

fn from_layout_type(other: &InOut<T>) -> U

Creates this layout type from another layout type.
source§

impl<T, U> CustomHardwareType<Input<T>> for U

source§

fn from_layout_type(other: &Input<T>) -> U

Creates this layout type from another layout type.
source§

impl<T, U> CustomHardwareType<Output<T>> for U

source§

fn from_layout_type(other: &Output<T>) -> U

Creates this layout type from another layout type.
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

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.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

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

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

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

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> Connect<&T> for T

source§

impl<T> Connect<T> for T

source§

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

source§

impl<T> Primitive for T
where T: Clone + Send + Sync + Any,

source§

impl<T> Primitive for T