Skip to content

Commit

Permalink
feat: get params as str (#1173)
Browse files Browse the repository at this point in the history
  • Loading branch information
polachok committed Aug 8, 2023
1 parent 54f4dcd commit 76fddae
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions types/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ impl<'a> Params<'a> {
None => 0,
}
}

/// Return the underlying JSON string as a `&str`.
pub fn as_str(&self) -> Option<&str> {
match self.0 {
Some(ref cow) => Some(cow.as_ref()),
None => None,
}
}
}

/// An `Iterator`-like parser for a sequence of [`Params`].
Expand Down

0 comments on commit 76fddae

Please sign in to comment.