Enum swc_css_ast::AlphaValue
source · [−]pub enum AlphaValue {
Number(Number),
Percentage(Percentage),
}
Variants
Number(Number)
Percentage(Percentage)
Implementations
sourceimpl AlphaValue
impl AlphaValue
sourcepub fn as_number(&self) -> Option<&Number>
pub fn as_number(&self) -> Option<&Number>
Returns Some
if self
is a reference of variant Number
, and None
otherwise.
sourcepub fn as_mut_number(&mut self) -> Option<&mut Number>
pub fn as_mut_number(&mut self) -> Option<&mut Number>
Returns Some
if self
is a mutable reference of variant Number
, and None
otherwise.
sourcepub fn expect_number(self) -> Numberwhere
Self: Debug,
pub fn expect_number(self) -> Numberwhere
Self: Debug,
sourcepub fn number(self) -> Option<Number>
pub fn number(self) -> Option<Number>
Returns Some
if self
is of variant Number
, and None
otherwise.
sourcepub fn is_percentage(&self) -> bool
pub fn is_percentage(&self) -> bool
Returns true
if self
is of variant Percentage
.
sourcepub fn as_percentage(&self) -> Option<&Percentage>
pub fn as_percentage(&self) -> Option<&Percentage>
Returns Some
if self
is a reference of variant Percentage
, and None
otherwise.
sourcepub fn as_mut_percentage(&mut self) -> Option<&mut Percentage>
pub fn as_mut_percentage(&mut self) -> Option<&mut Percentage>
Returns Some
if self
is a mutable reference of variant Percentage
, and None
otherwise.
sourcepub fn expect_percentage(self) -> Percentagewhere
Self: Debug,
pub fn expect_percentage(self) -> Percentagewhere
Self: Debug,
Unwraps the value, yielding the content of Percentage
.
Panics
Panics if the value is not Percentage
, with a panic message including the content of self
.
sourcepub fn percentage(self) -> Option<Percentage>
pub fn percentage(self) -> Option<Percentage>
Returns Some
if self
is of variant Percentage
, and None
otherwise.
Trait Implementations
sourceimpl Clone for AlphaValue
impl Clone for AlphaValue
sourcefn clone(&self) -> AlphaValue
fn clone(&self) -> AlphaValue
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for AlphaValue
impl Debug for AlphaValue
sourceimpl<'de> Deserialize<'de> for AlphaValue
impl<'de> Deserialize<'de> for AlphaValue
sourcefn 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
sourceimpl EqIgnoreSpan for AlphaValue
impl EqIgnoreSpan for AlphaValue
fn eq_ignore_span(&self, other: &Self) -> bool
sourceimpl From<AlphaValue> for ComponentValue
impl From<AlphaValue> for ComponentValue
sourcefn from(v: AlphaValue) -> Self
fn from(v: AlphaValue) -> Self
Converts to this type from the input type.
sourceimpl From<Number> for AlphaValue
impl From<Number> for AlphaValue
sourceimpl From<Percentage> for AlphaValue
impl From<Percentage> for AlphaValue
sourcefn from(v: Percentage) -> Self
fn from(v: Percentage) -> Self
Converts to this type from the input type.
sourceimpl Hash for AlphaValue
impl Hash for AlphaValue
sourceimpl PartialEq<AlphaValue> for AlphaValue
impl PartialEq<AlphaValue> for AlphaValue
sourcefn eq(&self, other: &AlphaValue) -> bool
fn eq(&self, other: &AlphaValue) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl Serialize for AlphaValue
impl Serialize for AlphaValue
sourceimpl Spanned for AlphaValue
impl Spanned for AlphaValue
impl Eq for AlphaValue
impl StructuralEq for AlphaValue
impl StructuralPartialEq for AlphaValue
Auto Trait Implementations
impl RefUnwindSafe for AlphaValue
impl Send for AlphaValue
impl Sync for AlphaValue
impl Unpin for AlphaValue
impl UnwindSafe for AlphaValue
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more