Skip to content

Commit

Permalink
Fix some doc links
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrobbel committed Jun 9, 2022
1 parent 875c2d7 commit 07b30d5
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions src/fmt.rs
Original file line number Diff line number Diff line change
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 07b30d5

Please sign in to comment.