Struct rocket_http::uri::Asterisk
source · pub struct Asterisk;
Expand description
The literal *
URI.
(De)serialization
Asterisk
is both Serialize
and Deserialize
:
use serde::{Serialize, Deserialize};
use rocket::http::uri::Asterisk;
#[derive(Deserialize, Serialize)]
struct UriOwned {
uri: Asterisk,
}
Implementations§
source§impl Asterisk
impl Asterisk
sourcepub fn parse(string: &str) -> Result<Asterisk, Error<'_>>
pub fn parse(string: &str) -> Result<Asterisk, Error<'_>>
Parses the string string
into an Asterisk
. Parsing will never
allocate. Returns an Error
if string
is not a valid asterisk URI.
Example
use rocket::http::uri::Asterisk;
assert!(Asterisk::parse("*").is_ok());
assert!(Asterisk::parse("/foo/bar").is_err());
// Prefer to use `uri!()` when the input is statically known:
let uri = uri!("*");
assert_eq!(uri, Asterisk);
sourcepub fn parse_owned(string: String) -> Result<Asterisk, Error<'static>>
pub fn parse_owned(string: String) -> Result<Asterisk, Error<'static>>
Parses the string string
into an Asterisk
. This is equivalent to
Asterisk::parse()
.
Example
use rocket::http::uri::Asterisk;
assert!(Asterisk::parse_owned("*".to_string()).is_ok());
assert!(Asterisk::parse_owned("/foo/bar".to_string()).is_err());
Trait Implementations§
source§impl PartialEq<Asterisk> for Asterisk
impl PartialEq<Asterisk> for Asterisk
source§impl<'b> PartialEq<Asterisk> for Uri<'b>
impl<'b> PartialEq<Asterisk> for Uri<'b>
source§impl<'b> PartialEq<Uri<'b>> for Asterisk
impl<'b> PartialEq<Uri<'b>> for Asterisk
impl Copy for Asterisk
impl Eq for Asterisk
impl StructuralEq for Asterisk
impl StructuralPartialEq for Asterisk
Auto Trait Implementations§
impl RefUnwindSafe for Asterisk
impl Send for Asterisk
impl Sync for Asterisk
impl Unpin for Asterisk
impl UnwindSafe for Asterisk
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.