Struct ValidatedAppIdentity

Source
pub struct ValidatedAppIdentity { /* private fields */ }
Expand description

Fully validated application identity used by runtime adapters.

§Examples

use ailloli_ui_core::{AppIcon, AppIdentity};

let validated = AppIdentity::new()
    .id("org.example.paint")
    .name("Paint")
    .icon(AppIcon::from_static_svg(b"<svg/>", "assets/icon.svg"))
    .validate()?;
assert_eq!(validated.id().as_str(), "org.example.paint");

Implementations§

Source§

impl ValidatedAppIdentity

Source

pub fn id(&self) -> &ApplicationId

Returns the validated reverse-DNS application identifier.

§Examples
use ailloli_ui_core::{AppIcon, AppIdentity};
let identity = AppIdentity::new().id("org.example.paint").name("Paint")
    .icon(AppIcon::from_static_svg(b"<svg/>", "icon.svg")).validate()?;
assert_eq!(identity.id().as_str(), "org.example.paint");
Source

pub fn name(&self) -> &str

Returns the trimmed, non-empty public display name.

§Examples
use ailloli_ui_core::{AppIcon, AppIdentity};
let identity = AppIdentity::new().id("org.example.paint").name(" Paint ")
    .icon(AppIcon::from_static_svg(b"<svg/>", "icon.svg")).validate()?;
assert_eq!(identity.name(), "Paint");
Source

pub fn icon(&self) -> &AppIcon

Returns the default icon and its original diagnostic source path.

§Examples
use ailloli_ui_core::{AppIcon, AppIdentity};
let identity = AppIdentity::new().id("org.example.paint").name("Paint")
    .icon(AppIcon::from_static_svg(b"<svg/>", "icon.svg")).validate()?;
assert_eq!(identity.icon().source_path(), "icon.svg");
Source

pub fn metadata(&self) -> AppIdentityMetadata

Builds the versioned metadata contract written for cargo-ailloli-ui.

The icon digest is computed on every call from its SVG bytes.

§Examples
use ailloli_ui_core::{AppIcon, AppIdentity, APP_IDENTITY_METADATA_VERSION};
let identity = AppIdentity::new().id("org.example.paint").name("Paint")
    .icon(AppIcon::from_static_svg(b"<svg/>", "icon.svg")).validate()?;
assert_eq!(identity.metadata().schema_version, APP_IDENTITY_METADATA_VERSION);

Trait Implementations§

Source§

impl Clone for ValidatedAppIdentity

Source§

fn clone(&self) -> ValidatedAppIdentity

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 Debug for ValidatedAppIdentity

Source§

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

Formats the value using the given formatter. 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> 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> Same for T

Source§

type Output = T

Should always be Self
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 = 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>,

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.