Skip to content

Commit

Permalink
Merge pull request #606 from mbrobbel/docs
Browse files Browse the repository at this point in the history
Fix some doc links
  • Loading branch information
KodrAus committed Jun 10, 2022
2 parents 875c2d7 + 07b30d5 commit c285879
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions src/fmt.rs
Expand Up @@ -63,103 +63,75 @@ impl fmt::UpperHex for Uuid {

/// Format a [`Uuid`] as a hyphenated string, like
/// `67e55044-10b1-426f-9247-bb680e5fe0c8`.
///
/// [`Uuid`]: ../struct.Uuid.html
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct Hyphenated(Uuid);

/// Format a [`Uuid`] as a simple string, like
/// `67e5504410b1426f9247bb680e5fe0c8`.
///
/// [`Uuid`]: ../struct.Uuid.html
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct Simple(Uuid);

/// Format a [`Uuid`] as a URN string, like
/// `urn:uuid:67e55044-10b1-426f-9247-bb680e5fe0c8`.
///
/// [`Uuid`]: ../struct.Uuid.html
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct Urn(Uuid);

/// Format a [`Uuid`] as a braced hyphenated string, like
/// `{67e55044-10b1-426f-9247-bb680e5fe0c8}`.
///
/// [`Uuid`]: ../struct.Uuid.html
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct Braced(Uuid);

impl Uuid {
/// Get a [`Hyphenated`] formatter.
///
/// [`Hyphenated`]: adapter/struct.Hyphenated.html
#[inline]
pub const fn hyphenated(self) -> Hyphenated {
Hyphenated(self)
}

/// Get a borrowed [`Hyphenated`] formatter.
///
/// [`Hyphenated`]: adapter/struct.Hyphenated.html
#[inline]
pub fn as_hyphenated(&self) -> &Hyphenated {
// SAFETY: `Uuid` and `Hyphenated` have the same ABI
unsafe { &*(self as *const Uuid as *const Hyphenated) }
}

/// Get a [`Simple`] formatter.
///
/// [`Simple`]: adapter/struct.Simple.html
#[inline]
pub const fn simple(self) -> Simple {
Simple(self)
}

/// Get a borrowed [`Simple`] formatter.
///
/// [`Simple`]: adapter/struct.Simple.html
#[inline]
pub fn as_simple(&self) -> &Simple {
// SAFETY: `Uuid` and `Simple` have the same ABI
unsafe { &*(self as *const Uuid as *const Simple) }
}

/// Get a [`Urn`] formatter.
///
/// [`Uuid`]: ../struct.Uuid.html
/// [`Urn`]: adapter/struct.Urn.html
#[inline]
pub const fn urn(self) -> Urn {
Urn(self)
}

/// Get a borrowed [`Urn`] formatter.
///
/// [`Uuid`]: ../struct.Uuid.html
/// [`Urn`]: adapter/struct.Urn.html
#[inline]
pub fn as_urn(&self) -> &Urn {
// SAFETY: `Uuid` and `Urn` have the same ABI
unsafe { &*(self as *const Uuid as *const Urn) }
}

/// Get a [`Braced`] formatter.
///
/// [`Uuid`]: ../struct.Uuid.html
/// [`Braced`]: adapter/struct.Braced.html
#[inline]
pub const fn braced(self) -> Braced {
Braced(self)
}

/// Get a borrowed [`Braced`] formatter.
///
/// [`Uuid`]: ../struct.Uuid.html
/// [`Braced`]: adapter/struct.Braced.html
#[inline]
pub fn as_braced(&self) -> &Braced {
// SAFETY: `Uuid` and `Braced` have the same ABI
Expand Down

0 comments on commit c285879

Please sign in to comment.