pub struct HostDevName(/* private fields */);Expand description
Validated host-side network device name (the host_dev_name field on a
/network-interfaces/{id} PUT body).
Validation: non-empty, ≤ 64 bytes, no NUL byte. Charset is left intentionally open
because the value is opaque on macOS — squib derives a vmnet handle name from
iface_id, not from host_dev_name, so we only need the length / NUL guard here.
The newtype is Serialize + Deserialize-transparent so it round-trips through
snapshot save/restore (see I-NET-3) without an envelope-format change.
Implementations§
Source§impl HostDevName
impl HostDevName
Sourcepub fn new(name: impl Into<String>) -> Result<Self, IdentifierError>
pub fn new(name: impl Into<String>) -> Result<Self, IdentifierError>
Wrap a host device name after running the boundary checks.
§Errors
Surfaces IdentifierError on empty / oversize / NUL-bearing input.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consume the newtype and yield the inner string.
Trait Implementations§
Source§impl AsRef<str> for HostDevName
impl AsRef<str> for HostDevName
Source§impl Clone for HostDevName
impl Clone for HostDevName
Source§fn clone(&self) -> HostDevName
fn clone(&self) -> HostDevName
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HostDevName
impl Debug for HostDevName
Source§impl<'de> Deserialize<'de> for HostDevName
impl<'de> Deserialize<'de> for HostDevName
Source§fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for HostDevName
impl Hash for HostDevName
Source§impl PartialEq for HostDevName
impl PartialEq for HostDevName
Source§fn eq(&self, other: &HostDevName) -> bool
fn eq(&self, other: &HostDevName) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for HostDevName
impl Serialize for HostDevName
impl Eq for HostDevName
impl StructuralPartialEq for HostDevName
Auto Trait Implementations§
impl Freeze for HostDevName
impl RefUnwindSafe for HostDevName
impl Send for HostDevName
impl Sync for HostDevName
impl Unpin for HostDevName
impl UnsafeUnpin for HostDevName
impl UnwindSafe for HostDevName
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