pub struct Center {
pub x: Ratio,
pub y: Ratio,
}Expand description
A structure representing the center of a gradient, defined by x and y ratios.
Fields§
§x: RatioThe horizontal position, as a ratio of the gradient’s width.
y: RatioThe vertical position, as a ratio of the gradient’s height.
Implementations§
Source§impl Center
impl Center
Sourcepub const fn new(x: Ratio, y: Ratio) -> Self
pub const fn new(x: Ratio, y: Ratio) -> Self
Creates a new Center instance with the specified x and y ratios.
§Arguments
x- The x ratio of the center.y- The y ratio of the center.
§Examples
use typwire::{Center, Ratio};
let center = Center::new(Ratio::new(0.5), Ratio::new(0.5));
assert_eq!(center.x, Ratio::new(0.5));
assert_eq!(center.y, Ratio::new(0.5));Trait Implementations§
Source§impl<'de> Deserialize<'de> for Center
impl<'de> Deserialize<'de> for Center
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Center
impl Typwire for Center
Auto Trait Implementations§
impl Forget for Center
impl Freeze for Center
impl Move for Center
impl RefUnwindSafe for Center
impl Send for Center
impl Sync for Center
impl Unpin for Center
impl UnsafeUnpin for Center
impl UnwindSafe for Center
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
Mutably borrows from an owned value. Read more