pub enum AlignmentGeometry {
Physical(Alignment),
Directional(AlignmentDirectional),
}Expand description
A resolvable anchor — either physical (Alignment) or directional
(AlignmentDirectional). A widget accepts either one, through Into, and
resolves it against the reading direction at render time.
Variants§
Physical(Alignment)
A physical anchor, with absolute left and right.
Directional(AlignmentDirectional)
A directional anchor (start/end, mirrored in RTL).
Implementations§
Source§impl AlignmentGeometry
impl AlignmentGeometry
Sourcepub fn resolve(self, direction: TextDirection) -> Alignment
pub fn resolve(self, direction: TextDirection) -> Alignment
Resolves to a physical anchor for a reading direction; an already physical anchor is returned unchanged.
Source§impl AlignmentGeometry
impl AlignmentGeometry
Sourcepub fn fractions(self) -> (f32, f32)
pub fn fractions(self) -> (f32, f32)
This anchor’s two fractions, in its own coordinates: x for a physical
anchor, start-to-end for a directional one.
Sourcepub fn with_fractions(self, x: f32, y: f32) -> AlignmentGeometry
pub fn with_fractions(self, x: f32, y: f32) -> AlignmentGeometry
The same kind of anchor with different fractions.
This is what an animation between two anchors interpolates. It stays in the anchor’s own coordinates, so the reading direction is applied to the result rather than to the endpoints — a directional anchor sliding from start to end mirrors as a whole in a right-to-left script, instead of interpolating between two physical points that were already mirrored and crossing in the middle.
Trait Implementations§
Source§impl Clone for AlignmentGeometry
impl Clone for AlignmentGeometry
Source§fn clone(&self) -> AlignmentGeometry
fn clone(&self) -> AlignmentGeometry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AlignmentGeometry
Source§impl Debug for AlignmentGeometry
impl Debug for AlignmentGeometry
Source§impl From<Alignment> for AlignmentGeometry
impl From<Alignment> for AlignmentGeometry
Source§fn from(a: Alignment) -> AlignmentGeometry
fn from(a: Alignment) -> AlignmentGeometry
Source§impl From<AlignmentDirectional> for AlignmentGeometry
impl From<AlignmentDirectional> for AlignmentGeometry
Source§fn from(d: AlignmentDirectional) -> AlignmentGeometry
fn from(d: AlignmentDirectional) -> AlignmentGeometry
Source§impl PartialEq for AlignmentGeometry
impl PartialEq for AlignmentGeometry
impl StructuralPartialEq for AlignmentGeometry
Auto Trait Implementations§
impl Freeze for AlignmentGeometry
impl RefUnwindSafe for AlignmentGeometry
impl Send for AlignmentGeometry
impl Sync for AlignmentGeometry
impl Unpin for AlignmentGeometry
impl UnsafeUnpin for AlignmentGeometry
impl UnwindSafe for AlignmentGeometry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.