pub struct SourceMap { /* private fields */ }
Expand description
Links to a file that maps transformed source to the original source.
§Specifications
§Examples
use http_types::{Response, Url};
use http_types::other::SourceMap;
let source_map = SourceMap::new(Url::parse("https://example.net/")?);
let mut res = Response::new(200);
source_map.apply(&mut res);
let base_url = Url::parse("https://example.net/")?;
let source_map = SourceMap::from_headers(base_url, res)?.unwrap();
assert_eq!(source_map.location(), &Url::parse("https://example.net/")?);
Implementations§
Source§impl SourceMap
impl SourceMap
Sourcepub fn from_headers<U>(
base_url: U,
headers: impl AsRef<Headers>,
) -> Result<Option<Self>>
pub fn from_headers<U>( base_url: U, headers: impl AsRef<Headers>, ) -> Result<Option<Self>>
Create a new instance from headers.
Sourcepub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
Sourcepub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SourceMap
impl RefUnwindSafe for SourceMap
impl Send for SourceMap
impl Sync for SourceMap
impl Unpin for SourceMap
impl UnwindSafe for SourceMap
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