Struct freya::prelude::dioxus_elements::svg
pub struct svg;
Expand description
svg
element let’s you display SVG code.
You will need to use the bytes_to_data
to transform the bytes into data the element can recognize.
Example
ⓘ
static FERRIS: &[u8] = include_bytes!("./ferris.svg");
fn app() -> Element {
let ferris = bytes_to_data(FERRIS);
rsx!(
svg {
svg_data: ferris,
}
)
}
Implementations§
§impl svg
impl svg
pub const margin: (&'static str, Option<&'static str>, bool) = _
pub const margin: (&'static str, Option<&'static str>, bool) = _
Specify the margin of an element. You can do so by four different ways, just like in CSS.
Example
fn app() -> Element {
rsx!(
rect {
margin: "25", // 25 in all sides
margin: "100 50", // 100 in top and bottom, and 50 in left and right
margin: "2 15 25", // 2 in top, 15 in left and right, and 25 in bottom
margin: "5 7 3 9" // 5 in top, 7 in right, 3 in bottom and 9 in left
}
)
}
pub const height: (&'static str, Option<&'static str>, bool) = _
pub const height: (&'static str, Option<&'static str>, bool) = _
Specify the width and height for the given element.
See syntax in Size Units
.
Example
fn app() -> Element {
rsx!(
rect {
background: "red",
width: "15",
height: "50",
}
)
}
pub const width: (&'static str, Option<&'static str>, bool) = _
pub const opacity: (&'static str, Option<&'static str>, bool) = _
pub const opacity: (&'static str, Option<&'static str>, bool) = _
Specify the opacity of an element and all its descendants.
Example
fn app() -> Element {
rsx!(
rect {
opacity: "0.5", // 50% visible
label {
"I am fading!"
}
}
)
}
pub const svg_data: (&'static str, Option<&'static str>, bool) = _
pub const svg_content: (&'static str, Option<&'static str>, bool) = _
pub const role: (&'static str, Option<&'static str>, bool) = _
pub const focus_id: (&'static str, Option<&'static str>, bool) = _
pub const alt: (&'static str, Option<&'static str>, bool) = _
pub const name: (&'static str, Option<&'static str>, bool) = _
pub const focusable: (&'static str, Option<&'static str>, bool) = _
Auto Trait Implementations§
impl RefUnwindSafe for svg
impl Send for svg
impl Sync for svg
impl Unpin for svg
impl UnwindSafe for svg
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T>) -> Box<dyn 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>
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)
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)
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere O: From<T>,
§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere O: SuperFrom<T, M>,
§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.