Skip to main content

PropValue

Enum PropValue 

Source
pub enum PropValue {
    Null,
    Bool(bool),
    Int(i64),
    Float(f64),
    String(String),
    Color(Color),
    Enum(String),
    Set(Vec<String>),
    Bounds(Bounds),
    Component(Option<ComponentId>),
    Event(Option<String>),
}
Expand description

Valor de uma propriedade.

Variants§

§

Null

§

Bool(bool)

§

Int(i64)

§

Float(f64)

§

String(String)

§

Color(Color)

§

Enum(String)

§

Set(Vec<String>)

§

Bounds(Bounds)

§

Component(Option<ComponentId>)

§

Event(Option<String>)

Implementations§

Source§

impl PropValue

Source

pub fn kind_name(&self) -> &'static str

Source

pub fn to_bool(&self) -> Result<bool>

Source

pub fn to_i64(&self) -> Result<i64>

Source

pub fn to_f64(&self) -> Result<f64>

Source

pub fn to_f32(&self) -> Result<f32>

Source

pub fn to_str(&self) -> Result<&str>

Source

pub fn to_color(&self) -> Result<Color>

Aceita uma cor ou um texto #RRGGBB[AA].

Source

pub fn to_bounds(&self) -> Result<Bounds>

Aceita Bounds ou um número (o mesmo valor nos quatro lados). Aceita também o texto, como no JSON: "8" (todos), "16, 12" (horizontal, vertical) ou "12, 4, 12, 0" (esquerda, cima, direita, baixo); vírgula ou espaço separam. É como o acesso tipado das linguagens manda margins e padding.

Source

pub fn to_enum<T: PropEnum>(&self) -> Result<T>

Aceita o nome do valor (como Enum ou String).

Source

pub fn to_anchors(&self) -> Result<Anchors>

Aceita uma lista de nomes ou um texto separado por vírgulas ("left,right").

Source

pub fn to_component(&self) -> Result<Option<ComponentId>>

Source

pub fn to_event(&self) -> Result<Option<String>>

Nome do handler de um evento (None desliga o evento).

Source§

impl PropValue

Source

pub fn enum_value<T: PropEnum>(v: T) -> Self

Valor de enum a partir de qualquer PropEnum.

Trait Implementations§

Source§

impl Clone for PropValue

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PropValue

Source§

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

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

impl Default for PropValue

Source§

fn default() -> Self

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

impl From<&str> for PropValue

Source§

fn from(v: &str) -> Self

Converts to this type from the input type.
Source§

impl From<Align> for PropValue

Source§

fn from(v: Align) -> Self

Converts to this type from the input type.
Source§

impl From<Anchors> for PropValue

Source§

fn from(v: Anchors) -> Self

Converts to this type from the input type.
Source§

impl From<Bounds> for PropValue

Source§

fn from(v: Bounds) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for PropValue

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<ColorRef> for PropValue

Source§

fn from(c: ColorRef) -> Self

Converts to this type from the input type.
Source§

impl From<ComponentId> for PropValue

Source§

fn from(v: ComponentId) -> Self

Converts to this type from the input type.
Source§

impl From<Option<ComponentId>> for PropValue

Source§

fn from(v: Option<ComponentId>) -> Self

Converts to this type from the input type.
Source§

impl From<Ref> for PropValue

Source§

fn from(r: Ref) -> Self

Converts to this type from the input type.
Source§

impl From<String> for PropValue

Source§

fn from(v: String) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for PropValue

Source§

fn from(v: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for PropValue

Source§

fn from(v: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for PropValue

Source§

fn from(v: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for PropValue

Source§

fn from(v: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for PropValue

Source§

fn from(v: i64) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for PropValue

Source§

fn from(v: u32) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for PropValue

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PropValue

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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.