Skip to main content

AuthoredPropertyTextV0

Struct AuthoredPropertyTextV0 

Source
pub struct AuthoredPropertyTextV0(/* private fields */);
Expand description

Authored CSS property text retained only for presentation and provenance.

This type deliberately implements no structural equality, ordering, hashing, or raw-string borrowing. Identity-bearing carriers pair it with a sealed canonical property key and use that key for every comparison or lookup. AuthoredPropertyTextV0::write_into and serialization are the only presentation exits. Identity projections stay inside the property-name authority.

use omena_syntax::ident::AuthoredPropertyTextV0;

struct Declaration {
    property: AuthoredPropertyTextV0,
}

let left = Declaration { property: AuthoredPropertyTextV0::new("--Foo") };
let right = Declaration { property: AuthoredPropertyTextV0::new("--foo") };
let _ = left.property == right.property;
use omena_syntax::ident::AuthoredPropertyTextV0;

struct Candidate {
    name: AuthoredPropertyTextV0,
}

let left = Candidate { name: AuthoredPropertyTextV0::new("--Foo") };
let right = Candidate { name: AuthoredPropertyTextV0::new("--foo") };
let _ = left.name == right.name;
use omena_syntax::ident::AuthoredPropertyTextV0;

let property = AuthoredPropertyTextV0::new("COLOR");
let _ = property.to_ascii_lowercase();
use omena_syntax::ident::AuthoredPropertyTextV0;

let property = AuthoredPropertyTextV0::new("COLOR");
let _ = property.to_lowercase();
use omena_syntax::ident::AuthoredPropertyTextV0;

let property = AuthoredPropertyTextV0::new("COLOR");
let _ = property.as_str();
use std::collections::HashMap;
use omena_syntax::ident::AuthoredPropertyTextV0;

let mut values = HashMap::<String, usize>::new();
values.insert(AuthoredPropertyTextV0::new("--token"), 1);
use omena_syntax::ident::AuthoredPropertyTextV0;

let property = AuthoredPropertyTextV0::new("--token");
let _ = property.to_string();
use omena_syntax::ident::AuthoredPropertyTextV0;

let property = AuthoredPropertyTextV0::new("--token");
let _ = format!("{}", property);
use std::fmt::Write;
use omena_syntax::ident::AuthoredPropertyTextV0;

let property = AuthoredPropertyTextV0::new("--token");
let mut output = String::new();
let _ = write!(&mut output, "{}", property);
use std::fmt;
use omena_syntax::ident::AuthoredPropertyTextV0;

struct Shown(AuthoredPropertyTextV0);
impl fmt::Display for Shown {
    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(formatter, "{}", self.0)
    }
}
use omena_syntax::ident::AuthoredPropertyTextV0;

struct Carrier(AuthoredPropertyTextV0);
let mut values = vec![Carrier(AuthoredPropertyTextV0::new("--token"))];
values.sort();

Implementations§

Source§

impl AuthoredPropertyTextV0

Source

pub fn new(authored: impl Into<String>) -> Self

Source

pub fn write_into(&self, out: &mut impl Write) -> Result

Writes the source spelling to a presentation sink without exposing a borrowable raw string that could be reused as an identity key.

Source

pub fn is_empty(&self) -> bool

Source

pub fn to_property_name(&self) -> PropertyNameV0

Source

pub fn to_custom_key(&self) -> CanonicalCustomPropertyNameV0

Source

pub fn to_standard_key(&self) -> CanonicalStandardPropertyNameV0

Trait Implementations§

Source§

impl Clone for AuthoredPropertyTextV0

Source§

fn clone(&self) -> AuthoredPropertyTextV0

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 AuthoredPropertyTextV0

Source§

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

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

impl<'de> Deserialize<'de> for AuthoredPropertyTextV0

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for AuthoredPropertyTextV0

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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, <T as TryFrom<U>>::Error>

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.