pub struct UrlWithBlobClaim {
url: ServoUrl,
token: Option<TokenSerializationGuard>,
}Expand description
This type upholds the variant that if the URL is a valid blob URL, then it has
a token. Violating this invariant causes logic errors, but no unsafety.
Fields§
§url: ServoUrl§token: Option<TokenSerializationGuard>Implementations§
Source§impl UrlWithBlobClaim
impl UrlWithBlobClaim
pub fn new(url: ServoUrl, token: Option<TokenSerializationGuard>) -> Self
pub fn token(&self) -> Option<&BlobToken>
pub fn blob_id(&self) -> Option<Uuid>
pub fn origin(&self) -> ImmutableOrigin
Sourcepub fn for_url(url: ServoUrl) -> Result<Self, ServoUrl>
pub fn for_url(url: ServoUrl) -> Result<Self, ServoUrl>
Constructs a UrlWithBlobClaim for URLs that are not blob URLs
(Such URLs don’t need to claim anything).
Returns an Err containing the original URL if it’s a blob URL,
so it can be reused without cloning.
Sourcepub fn from_url_without_having_claimed_blob(url: ServoUrl) -> Self
pub fn from_url_without_having_claimed_blob(url: ServoUrl) -> Self
This method should only exist temporarily, and all callers should either
claim the blob or guarantee that the URL is not a blob URL.
pub fn url(&self) -> ServoUrl
Methods from Deref<Target = ServoUrl>§
pub fn get_arc(&self) -> Arc<Url>
pub fn as_url(&self) -> &Url
pub fn cannot_be_a_base(&self) -> bool
pub fn domain(&self) -> Option<&str>
pub fn fragment(&self) -> Option<&str>
pub fn path(&self) -> &str
pub fn origin(&self) -> ImmutableOrigin
pub fn scheme(&self) -> &str
pub fn is_secure_scheme(&self) -> bool
Sourcepub fn is_local_scheme(&self) -> bool
pub fn is_local_scheme(&self) -> bool
Sourcepub fn is_special_scheme(&self) -> bool
pub fn is_special_scheme(&self) -> bool
Sourcepub fn is_equal_excluding_fragments(&self, other: &ServoUrl) -> bool
pub fn is_equal_excluding_fragments(&self, other: &ServoUrl) -> bool
https://url.spec.whatwg.org/#url-equivalence In the future this may be removed if the helper is added upstream in rust-url see https://github.com/servo/rust-url/issues/1063 for details
pub fn as_str(&self) -> &str
pub fn as_mut_url(&mut self) -> &mut Url
pub fn set_username(&mut self, user: &str) -> Result<(), UrlError>
pub fn set_ip_host(&mut self, addr: IpAddr) -> Result<(), UrlError>
pub fn set_password(&mut self, pass: Option<&str>) -> Result<(), UrlError>
pub fn set_fragment(&mut self, fragment: Option<&str>)
pub fn username(&self) -> &str
pub fn password(&self) -> Option<&str>
pub fn to_file_path(&self) -> Result<PathBuf, UrlError>
pub fn host(&self) -> Option<Host<&str>>
pub fn host_str(&self) -> Option<&str>
pub fn port(&self) -> Option<u16>
pub fn port_or_known_default(&self) -> Option<u16>
pub fn join(&self, input: &str) -> Result<ServoUrl, ParseError>
pub fn path_segments(&self) -> Option<Split<'_, char>>
pub fn query(&self) -> Option<&str>
Sourcepub fn debug_compact(&self) -> impl Display
pub fn debug_compact(&self) -> impl Display
Return a non-standard shortened form of the URL. Mainly intended to be used for debug printing in a constrained space (e.g., thread names).
Sourcepub fn is_potentially_trustworthy(&self) -> bool
pub fn is_potentially_trustworthy(&self) -> bool
Trait Implementations§
Source§impl Clone for UrlWithBlobClaim
impl Clone for UrlWithBlobClaim
Source§fn clone(&self) -> UrlWithBlobClaim
fn clone(&self) -> UrlWithBlobClaim
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UrlWithBlobClaim
impl Debug for UrlWithBlobClaim
Source§impl Deref for UrlWithBlobClaim
impl Deref for UrlWithBlobClaim
Source§impl DerefMut for UrlWithBlobClaim
impl DerefMut for UrlWithBlobClaim
Source§impl<'de> Deserialize<'de> for UrlWithBlobClaim
impl<'de> Deserialize<'de> for UrlWithBlobClaim
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl MallocSizeOf for UrlWithBlobClaim
impl MallocSizeOf for UrlWithBlobClaim
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl Freeze for UrlWithBlobClaim
impl !RefUnwindSafe for UrlWithBlobClaim
impl Send for UrlWithBlobClaim
impl Sync for UrlWithBlobClaim
impl Unpin for UrlWithBlobClaim
impl !UnwindSafe for UrlWithBlobClaim
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more