Skip to content

Commit 64e4853

Browse files
sectoreMaximkaaa
authored andcommitted
doc examples for _modifier functions
In addition to galileo-map#253
1 parent 3678449 commit 64e4853

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

galileo/src/layer/raster_tile_layer/builder.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,25 @@ impl RasterTileLayerBuilder {
180180
}
181181

182182
/// Same as [`with_file_cache`], but also modifies the file path by given `modifier` function
183+
///
184+
/// ```
185+
/// use galileo::layer::raster_tile_layer::RasterTileLayerBuilder;
186+
///
187+
/// let layer = RasterTileLayerBuilder::new_rest(
188+
/// |index| {
189+
/// format!(
190+
/// "https://tile.openstreetmap.org/{}/{}/{}.png",
191+
/// index.z, index.x, index.y
192+
/// )
193+
/// })
194+
/// .with_file_cache_modifier(
195+
/// "./target",
196+
/// // modify file path to be `uppercase`
197+
/// Box::new(|path| path.to_uppercase())
198+
/// )
199+
/// .build()?;
200+
/// # Ok::<(), galileo::error::GalileoError>(())
201+
/// ```
183202
pub fn with_file_cache_modifier(
184203
mut self,
185204
path: impl AsRef<Path>,
@@ -223,6 +242,25 @@ impl RasterTileLayerBuilder {
223242
}
224243

225244
/// Same as [`with_file_cache_checked`], but also modifies the file path by given `modifier` function
245+
///
246+
/// ```
247+
/// use galileo::layer::raster_tile_layer::RasterTileLayerBuilder;
248+
///
249+
/// let layer = RasterTileLayerBuilder::new_rest(
250+
/// |index| {
251+
/// format!(
252+
/// "https://tile.openstreetmap.org/{}/{}/{}.png",
253+
/// index.z, index.x, index.y
254+
/// )
255+
/// })
256+
/// .with_file_cache_modifier_checked(
257+
/// "./target",
258+
/// // modify file path to be `uppercase`
259+
/// Box::new(|path| path.to_uppercase())
260+
/// )
261+
/// .build()?;
262+
/// # Ok::<(), galileo::error::GalileoError>(())
263+
/// ```
226264
pub fn with_file_cache_modifier_checked(
227265
self,
228266
_path: impl AsRef<Path>,

0 commit comments

Comments
 (0)