Skip to main content

DataSourceExt

Trait DataSourceExt 

Source
pub trait DataSourceExt: IsA<DataSource> + 'static {
    // Provided methods
    fn max_zoom_level(&self) -> u32 { ... }
    fn min_zoom_level(&self) -> u32 { ... }
    fn tile_data_async<P: FnOnce(Result<Option<Bytes>, Error>) + 'static>(
        &self,
        x: i32,
        y: i32,
        zoom_level: i32,
        cancellable: Option<&impl IsA<Cancellable>>,
        callback: P,
    ) { ... }
    fn tile_data_future(
        &self,
        x: i32,
        y: i32,
        zoom_level: i32,
    ) -> Pin<Box_<dyn Future<Output = Result<Option<Bytes>, Error>> + 'static>> { ... }
    fn set_max_zoom_level(&self, zoom_level: u32) { ... }
    fn set_min_zoom_level(&self, zoom_level: u32) { ... }
    fn start_request(
        &self,
        x: i32,
        y: i32,
        zoom_level: i32,
        cancellable: Option<&impl IsA<Cancellable>>,
    ) -> Option<DataSourceRequest> { ... }
    fn connect_received_data<F: Fn(&Self, i32, i32, i32, &Bytes) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
    fn connect_max_zoom_level_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
    fn connect_min_zoom_level_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all DataSource methods.

§Implementors

DataSource, TileDownloader

Provided Methods§

Source

fn max_zoom_level(&self) -> u32

Gets the data source’s maximum zoom level.

§Returns

the maximum zoom level this data source supports

Source

fn min_zoom_level(&self) -> u32

Gets the data source’s minimum zoom level.

§Returns

the minimum zoom level this data source supports

Source

fn tile_data_async<P: FnOnce(Result<Option<Bytes>, Error>) + 'static>( &self, x: i32, y: i32, zoom_level: i32, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Gets the data for the tile at the given coordinates.

Some data sources may return data multiple times. For example, TileDownloader may return data from a cache, then return updated data from the network. [received-data][struct@crate::ShumateDataSource#received-data] is emitted each time data is received, then @callback is called after the last update.

§x

the X coordinate to fetch

§y

the Y coordinate to fetch

§zoom_level

the Z coordinate to fetch

§cancellable

a #GCancellable

§callback

a #GAsyncReadyCallback to execute upon completion

Source

fn tile_data_future( &self, x: i32, y: i32, zoom_level: i32, ) -> Pin<Box_<dyn Future<Output = Result<Option<Bytes>, Error>> + 'static>>

Source

fn set_max_zoom_level(&self, zoom_level: u32)

Sets the data source’s maximum zoom level.

§zoom_level

the maximum zoom level

Source

fn set_min_zoom_level(&self, zoom_level: u32)

Sets the data source’s minimum zoom level.

§zoom_level

the minimum zoom level

Source

fn start_request( &self, x: i32, y: i32, zoom_level: i32, cancellable: Option<&impl IsA<Cancellable>>, ) -> Option<DataSourceRequest>

Begins a request for a tile.

§x

X coordinate to request

§y

Y coordinate to request

§zoom_level

zoom level to request

§cancellable

for cancelling the request

§Returns

a DataSourceRequest object for tracking the request.

Source

fn connect_received_data<F: Fn(&Self, i32, i32, i32, &Bytes) + 'static>( &self, f: F, ) -> SignalHandlerId

👎Deprecated:

Since 1.1

Emitted when data is received for any tile. This includes any intermediate steps, such as data from the file cache, as well as the final result.

§Deprecated since 1.1

Use start_request() and connect to the notify signals of the resulting DataSourceRequest.

§x

the X coordinate of the tile

§y

the Y coordinate of the tile

§zoom_level

the zoom level of the tile

§bytes

the received data

Source

fn connect_max_zoom_level_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_min_zoom_level_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§