Skip to content

Commit

Permalink
Update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yescallop committed Sep 21, 2024
1 parent 8dbb3d4 commit 9462907
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/encoding/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ impl Encoder for Port {

/// An encoder for URI path.
///
/// [`EStr`] has extension methods for the path component.
/// `EStr` has [extension methods] for the path component.
///
/// [`EStr`]: super::EStr
/// [extension methods]: super::EStr#impl-EStr<E>-1
#[derive(Debug, Clone, Copy)]
pub struct Path(());

Expand All @@ -57,9 +57,9 @@ impl Encoder for Path {

/// An encoder for IRI path.
///
/// [`EStr`] has extension methods for the path component.
/// `EStr` has [extension methods] for the path component.
///
/// [`EStr`]: super::EStr
/// [extension methods]: super::EStr#impl-EStr<E>-1
#[derive(Debug, Clone, Copy)]
pub struct IPath(());

Expand Down
11 changes: 10 additions & 1 deletion src/encoding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,20 @@ impl<E: Encoder> EStr<E> {
self.inner.is_empty()
}

/// Upcasts the `EStr` slice to associate with the given super-encoder.
/// Upcasts the `EStr` slice to associate it with the given super-encoder.
///
/// # Panics
///
/// Panics at compile time if `E` is not a [sub-encoder](Encoder#sub-encoders) of `SuperE`.
///
/// # Example
///
/// ```
/// use fluent_uri::encoding::{encoder::{IPath, Path}, EStr};
///
/// let path = EStr::<Path>::new_or_panic("foo");
/// let path: &EStr<IPath> = path.upcast();
/// ```
#[cfg(fluent_uri_unstable)]
#[must_use]
pub fn upcast<SuperE: Encoder>(&self) -> &EStr<SuperE> {
Expand Down
3 changes: 2 additions & 1 deletion src/ri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,10 @@ macro_rules! ri_maybe_ref {
///
/// The path component is always present, although it may be empty.
///
/// The returned [`EStr`] slice has extension methods for the path component.
/// The returned `EStr` slice has [extension methods] for the path component.
///
/// [path]: https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
/// [extension methods]: EStr#impl-EStr<E>-1
///
/// # Examples
///
Expand Down

0 comments on commit 9462907

Please sign in to comment.