pub struct PushHint {
pub url: String,
pub rel: PushRel,
pub type_: Option<String>,
pub as_: Option<String>,
pub crossorigin: bool,
pub nopush: bool,
}Expand description
An HTTP/2 server push hint represented as a Link header entry.
Fields§
§url: StringThe URL of the resource to push.
rel: PushRelThe link relation type.
type_: Option<String>Optional MIME type (type attribute).
as_: Option<String>Optional resource type (as attribute: "image", "fetch", etc.).
crossorigin: boolWhether to add the crossorigin attribute.
nopush: boolIf true, add nopush (preload without an actual server push).
Implementations§
Source§impl PushHint
impl PushHint
Sourcepub fn new(url: impl Into<String>, rel: PushRel) -> Self
pub fn new(url: impl Into<String>, rel: PushRel) -> Self
Creates a minimal push hint with all optional fields unset.
Sourcepub fn preload_tile(url: impl Into<String>, format: &TileFormat) -> Self
pub fn preload_tile(url: impl Into<String>, format: &TileFormat) -> Self
Creates a Preload push hint for a tile, setting as_ and type_
according to the tile format.
Sourcepub fn to_link_header(&self) -> String
pub fn to_link_header(&self) -> String
Serialises this hint as a single Link header value entry.
Example: </tiles/roads/10/512/384.mvt>; rel=preload; as=fetch; type="application/vnd.mapbox-vector-tile"
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PushHint
impl RefUnwindSafe for PushHint
impl Send for PushHint
impl Sync for PushHint
impl Unpin for PushHint
impl UnsafeUnpin for PushHint
impl UnwindSafe for PushHint
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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