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
impl ValidatedAppIdentity
Sourcepub fn id(&self) -> &ApplicationId
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");Sourcepub fn name(&self) -> &str
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");Sourcepub fn icon(&self) -> &AppIcon
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");Sourcepub fn metadata(&self) -> AppIdentityMetadata
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
impl Clone for ValidatedAppIdentity
Source§fn clone(&self) -> ValidatedAppIdentity
fn clone(&self) -> ValidatedAppIdentity
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ValidatedAppIdentity
impl RefUnwindSafe for ValidatedAppIdentity
impl Send for ValidatedAppIdentity
impl Sync for ValidatedAppIdentity
impl Unpin for ValidatedAppIdentity
impl UnwindSafe for ValidatedAppIdentity
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