Struct zbus_names::UniqueName[][src]

pub struct UniqueName<'name>(_);
Expand description

String that identifies a unique bus name.

Examples

use core::convert::TryFrom;
use zbus_names::UniqueName;

// Valid unique names.
let name = UniqueName::try_from(":org.gnome.Service-for_you").unwrap();
assert_eq!(name, ":org.gnome.Service-for_you");
let name = UniqueName::try_from(":a.very.loooooooooooooooooo-ooooooo_0000o0ng.Name").unwrap();
assert_eq!(name, ":a.very.loooooooooooooooooo-ooooooo_0000o0ng.Name");

// Invalid unique names
UniqueName::try_from("").unwrap_err();
UniqueName::try_from("dont.start.with.a.colon").unwrap_err();
UniqueName::try_from(":double..dots").unwrap_err();
UniqueName::try_from(".").unwrap_err();
UniqueName::try_from(".start.with.dot").unwrap_err();
UniqueName::try_from(":no-dots").unwrap_err();

Implementations

The unique name as string.

Create a new UniqueName from the given string.

Since the passed string is not checked for correctness, prefer using the TryFrom<&str> implementation.

Same as from_str_unchecked, except it takes an owned String.

Since the passed string is not checked for correctness, prefer using the TryFrom<String> implementation.

Creates an owned clone of self.

Creates an owned clone of self.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The none-equivalent value.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Try to create an UniqueName from a string.

The type returned in the event of a conversion error.

Performs the conversion.

This never succeeds but is provided so it’s easier to pass Option::None values for API requiring Option<TryInto<impl BusName>>, since type inference won’t work here.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Get the signature for the implementing type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.