FetchReader

Struct FetchReader 

Source
pub struct FetchReader { /* private fields */ }
Available on crate feature std or WebAssembly or crate feature wasm only.
Expand description

§Fetch Reader

§Description

The browser reader that fetches data from a URL.

Implements the Reader trait.

Useful for crate::readers::PMTilesReader and crate::readers::S2TilesReader

§Usage

use gistools::{
    parsers::FetchReader,
    readers::PMTilesReader,
};
use s2_tilejson::{Encoding, Metadata, Scheme, SourceType};

let url = "...".into();
let mut reader = PMTilesReader::new(FetchReader::new(url, true), None);

let metadata = reader.get_metadata();
assert_eq!(
    *metadata,
    Metadata {
        s2tilejson: "1.0.0".into(),
        version: "1.0.0".into(),
        name: "default".into(),
        scheme: Scheme::Fzxy,
        description: "Built with s2maps-cli".into(),
        r#type: SourceType::Vector,
        extension: "pbf".into(),
        encoding: Encoding::None,
        minzoom: 0,
        maxzoom: 27,
        ..Default::default()
    }
);

Implementations§

Source§

impl FetchReader

Source

pub fn new(path: String, range_requests: bool) -> Self

Create a new FetchReader

§Parameters
  • path: the location of the PMTiles data
  • range_requests: FetchReader specific; enable range requests or use urlParam “bytes”

Trait Implementations§

Source§

impl Clone for FetchReader

Source§

fn clone(&self) -> FetchReader

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FetchReader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Reader for FetchReader

Source§

fn len(&self) -> u64

Get the number of bytes in the reader
Source§

fn uint64(&self, _byte_offset: Option<u64>, _little_endian: Option<bool>) -> u64

Get the unsigned 64 bit integer at the given byte offset and endian. Default to big-endian
Source§

fn uint64_be(&self, _byte_offset: Option<u64>) -> u64

Get the big-endian unsigned 64 bit integer at the given byte offset
Source§

fn uint64_le(&self, _byte_offset: Option<u64>) -> u64

Get the little-endian unsigned 64 bit integer at the given byte offset
Source§

fn int64(&self, _byte_offset: Option<u64>, _little_endian: Option<bool>) -> i64

Get the signed 64 bit integer at the given byte offset and endian. Default to big-endian
Source§

fn int64_be(&self, _byte_offset: Option<u64>) -> i64

Get the big-endian signed 64 bit integer at the given byte offset
Source§

fn int64_le(&self, _byte_offset: Option<u64>) -> i64

Get the little-endian signed 64 bit integer at the given byte offset
Source§

fn f64(&self, _byte_offset: Option<u64>, _little_endian: Option<bool>) -> f64

Get the 64 bit floating point at the given byte offset and endian. Default to big-endian
Source§

fn f64_be(&self, _byte_offset: Option<u64>) -> f64

Get the big-endian floating point 64 bit integer at the given byte offset
Source§

fn f64_le(&self, _byte_offset: Option<u64>) -> f64

Get the little-endian floating point 64 bit integer at the given byte offset
Source§

fn uint32(&self, _byte_offset: Option<u64>, _little_endian: Option<bool>) -> u32

Get the unsigned 32 bit integer at the given byte offset and endian. Default to big-endian
Source§

fn uint32_be(&self, _byte_offset: Option<u64>) -> u32

Get the big-endian unsigned 32 bit integer at the given byte offset
Source§

fn uint32_le(&self, _byte_offset: Option<u64>) -> u32

Get the little-endian unsigned 32 bit integer at the given byte offset
Source§

fn int32(&self, _byte_offset: Option<u64>, _little_endian: Option<bool>) -> i32

Get the signed 32 bit integer at the given byte offset and endian. Default to big-endian
Source§

fn int32_be(&self, _byte_offset: Option<u64>) -> i32

Get the big-endian signed 32 bit integer at the given byte offset
Source§

fn int32_le(&self, _byte_offset: Option<u64>) -> i32

Get the little-endian signed 32 bit integer at the given byte offset
Source§

fn f32(&self, _byte_offset: Option<u64>, _little_endian: Option<bool>) -> f32

Get the 32 bit floating point at the given byte offset and endian. Default to big-endian
Source§

fn f32_be(&self, _byte_offset: Option<u64>) -> f32

Get the big-endian floating point 32 bit integer at the given byte offset
Source§

fn f32_le(&self, _byte_offset: Option<u64>) -> f32

Get the little-endian floating point 32 bit integer at the given byte offset
Source§

fn uint16(&self, _byte_offset: Option<u64>, _little_endian: Option<bool>) -> u16

Get the unsigned 16 bit integer at the given byte offset and endian. Default to big-endian
Source§

fn uint16_be(&self, _byte_offset: Option<u64>) -> u16

Get the big-endian unsigned 16 bit integer at the given byte offset
Source§

fn uint16_le(&self, _byte_offset: Option<u64>) -> u16

Get the little-endian unsigned 16 bit integer at the given byte offset
Source§

fn int16(&self, _byte_offset: Option<u64>, _little_endian: Option<bool>) -> i16

Get the signed 16 bit integer at the given byte offset and endian. Default to big-endian
Source§

fn int16_be(&self, _byte_offset: Option<u64>) -> i16

Get the big-endian signed 16 bit integer at the given byte offset
Source§

fn int16_le(&self, _byte_offset: Option<u64>) -> i16

Get the little-endian signed 16 bit integer at the given byte offset
Source§

fn f16(&self, _byte_offset: Option<u64>, _little_endian: Option<bool>) -> f32

Get the 16 bit floating point at the given byte offset and endian. Default to big-endian
Source§

fn f16_be(&self, _byte_offset: Option<u64>) -> f32

Get the big-endian floating point 16 bit integer at the given byte offset
Source§

fn f16_le(&self, _byte_offset: Option<u64>) -> f32

Get the little-endian floating point 16 bit integer at the given byte offset
Source§

fn uint8(&self, _byte_offset: Option<u64>) -> u8

Get the unsigned 8 bit integer at the given byte offset
Source§

fn int8(&self, _byte_offset: Option<u64>) -> i8

Get the signed 8 bit integer at the given byte offset
Source§

fn tell(&self) -> u64

Seek to the given byte offset
Source§

fn seek(&self, pos: u64)

Seek to the given byte offset
Source§

fn slice(&self, _begin: Option<u64>, _end: Option<u64>) -> Vec<u8>

Get a slice of the reader
Source§

fn seek_slice(&self, _size: usize) -> Vec<u8>

Get a slice of the reader at the current position
Source§

fn parse_string( &self, _byte_offset: Option<u64>, _byte_length: Option<u64>, ) -> String

Parse a string from the reader
Source§

async fn get_slice(&self, byte_offset: u64, byte_length: Option<u64>) -> Vec<u8>

Fetch based mechanic. Defaults to slice mechanic
Source§

fn is_empty(&self) -> bool

See if empty

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V