Struct silkenweb::elements::svg::path::Data

source ·
pub struct Data(/* private fields */);
Expand description

Construct path data for the d attribute

§Example

let path: Path<Dry> = path().d(Data::new()
    .move_to(Abs, 10.0, 10.0)
    .lines_to(Abs, [(20.0, 20.0), (30.0, 30.0)]));

assert_eq!(
    r#"<path d="M 10,10 L 20,20 30,30"></path>"#,
    path.freeze().to_string()
);

Implementations§

source§

impl Data

source

pub fn new() -> Self

source

pub fn new_with_capacity(capacity: usize) -> Self

source

pub fn move_to(self, offset: Offset, x: f64, y: f64) -> Self

The m/M commands (MDN Docs)

source

pub fn lines_to( self, offset: Offset, ends: impl IntoIterator<Item = (f64, f64)> ) -> Self

The l/L commands (MDN Docs)

source

pub fn horizontal_lines_to( self, offset: Offset, ends: impl IntoIterator<Item = f64> ) -> Self

The h/H commands (MDN Docs)

source

pub fn vertical_lines_to( self, offset: Offset, ends: impl IntoIterator<Item = f64> ) -> Self

The v/V commands (MDN Docs)

source

pub fn cubic_bezier_curves( self, offset: Offset, args: impl IntoIterator<Item = (f64, f64, f64, f64, f64, f64)> ) -> Self

The c/C commands (MDN Docs)

source

pub fn smooth_cubic_bezier_curves( self, offset: Offset, args: impl IntoIterator<Item = (f64, f64, f64, f64)> ) -> Self

The s/S commands (MDN Docs)

source

pub fn quadradic_bezier_curves( self, offset: Offset, args: impl IntoIterator<Item = (f64, f64, f64, f64)> ) -> Self

The q/Q commands (MDN Docs)

source

pub fn smooth_quadradic_bezier_curves( self, offset: Offset, end_points: impl IntoIterator<Item = (f64, f64)> ) -> Self

The t/T commands (MDN Docs)

source

pub fn elliptical_arc_curves( self, offset: Offset, args: impl IntoIterator<Item = (f64, f64, f64, f64, f64, f64, f64)> ) -> Self

The a/A commands (MDN Docs)

Trait Implementations§

source§

impl Attribute for Data

§

type Text<'a> = &'a str

source§

fn text(&self) -> Option<Self::Text<'_>>

The attribute value text. Read more
source§

impl Clone for Data

source§

fn clone(&self) -> Data

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 Default for Data

source§

fn default() -> Data

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

impl<'a> AsAttribute<Data> for &'a str

source§

impl AsAttribute<Data> for Data

source§

impl AsAttribute<Data> for String

source§

impl Value for Data

Auto Trait Implementations§

§

impl Freeze for Data

§

impl RefUnwindSafe for Data

§

impl Send for Data

§

impl Sync for Data

§

impl Unpin for Data

§

impl UnwindSafe for Data

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> 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> 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<'a, T> RefSignalOrValue<'a> for T
where T: RefValue<'a> + 'a,

§

type Item = T

The underlying type of the value or signal.
§

type Map<'b: 'a, F: FnMut(<T as RefSignalOrValue<'a>>::Item) -> R + 'b, R: RefSignalOrValue<'b, Item = R> + 'b> = R

The return type for Self::map. Read more
§

type Signal = Always<<T as RefSignalOrValue<'a>>::Item>

The signal type. Use Always for value types.
source§

fn map<'b, F, R>( self, callback: F ) -> <T as RefSignalOrValue<'a>>::Map<'b, F, R>
where 'b: 'a, R: RefSignalOrValue<'b, Item = R> + 'b, F: FnMut(<T as RefSignalOrValue<'a>>::Item) -> R + 'b,

Map a function over this signal/value to produce a new signal/value.
source§

fn select<FVal, FSig, Data, Out>( self, fn_val: FVal, _fn_sig: FSig, data: Data ) -> Out
where FVal: FnOnce(Data, <T as RefSignalOrValue<'a>>::Item) -> Out, FSig: FnOnce(Data, <T as RefSignalOrValue<'a>>::Signal) -> Out,

Select a function based on whether this is a signal or value. Read more
source§

fn select_spawn<FVal, FSig, Task, Exec>( self, fn_val: FVal, _fn_sig: FSig, executor: &mut Exec )
where FVal: FnOnce(&mut Exec, <T as RefSignalOrValue<'a>>::Item), FSig: FnOnce(&mut Exec, <T as RefSignalOrValue<'a>>::Signal) -> Task, Task: Future<Output = ()> + 'a, Exec: Executor,

Select a function based on whether this is a signal or value. Read more
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> RefValue<'static> for T
where T: Value,

source§

impl<T> SignalOrValue for T
where T: RefSignalOrValue<'static>,