Skip to content

Commit 0c3152c

Browse files
authored
Improve parse_url_opts documentation (#377)
* Improve parse_url_opts documentation * fix link * fmt
1 parent 3dcf30d commit 0c3152c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/parse.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,27 @@ pub fn parse_url(url: &Url) -> Result<(Box<dyn ObjectStore>, Path), super::Error
164164

165165
/// Create an [`ObjectStore`] based on the provided `url` and options
166166
///
167+
/// This method can be used to create an instance of one of the provided
168+
/// `ObjectStore` implementations based on the URL scheme (see
169+
/// [`ObjectStoreScheme`] for more details).
170+
///
171+
/// For example
172+
/// * `file:///path/to/my/file` will return a [`LocalFileSystem`] instance
173+
/// * `s3://bucket/path` will return an [`AmazonS3`] instance if the `aws` feature is enabled.
174+
///
175+
/// Arguments:
176+
/// * `url`: The URL to parse
177+
/// * `options`: A list of key-value pairs to pass to the [`ObjectStore`] builder.
178+
/// Note different object stores accept different configuration options, so
179+
/// the options that are read depends on the `url` value. One common pattern
180+
/// is to pass configuration information via process variables using
181+
/// [`std::env::vars`].
182+
///
167183
/// Returns
168184
/// - An [`ObjectStore`] of the corresponding type
169185
/// - The [`Path`] into the [`ObjectStore`] of the addressed resource
186+
///
187+
/// [`AmazonS3`]: https://docs.rs/object_store/0.12.0/object_store/aws/struct.AmazonS3.html
170188
pub fn parse_url_opts<I, K, V>(
171189
url: &Url,
172190
options: I,

0 commit comments

Comments
 (0)