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<'a, 'de> Deserialize<'de> for Asterisk
impl<'a, 'de> Deserialize<'de> for Asterisk
source§fn deserialize<D>(
deserializer: D
) -> Result<Asterisk, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>( deserializer: D ) -> Result<Asterisk, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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
source§impl<'a> Serialize for Asterisk
impl<'a> Serialize for Asterisk
source§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
Serialize this value into the given Serde serializer. Read more
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§
§impl<'a, T> AsTaggedExplicit<'a> for Twhere
T: 'a,
impl<'a, T> AsTaggedExplicit<'a> for Twhere T: 'a,
§impl<'a, T> AsTaggedImplicit<'a> for Twhere
T: 'a,
impl<'a, T> AsTaggedImplicit<'a> for Twhere T: 'a,
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.