Skip to content

Commit fc35fc0

Browse files
committed
feat:metadata add docs to public methods
1 parent bb9e43a commit fc35fc0

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/metadata/fetch.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,16 @@ impl<T: AsyncFileReader> MetadataFetch for T {
2828
}
2929
}
3030

31+
/// An endian-aware cursor into the tiff
32+
#[derive(Debug)]
3133
pub struct MetadataCursor<'a, F: MetadataFetch> {
3234
fetch: &'a F,
3335
offset: u64,
3436
endianness: Endianness,
3537
}
3638

3739
impl<'a, F: MetadataFetch> MetadataCursor<'a, F> {
40+
/// Create a new MetadataCursor pointing at the start of the tiff
3841
pub fn new(fetch: &'a F, endianness: Endianness) -> Self {
3942
Self {
4043
fetch,
@@ -43,6 +46,7 @@ impl<'a, F: MetadataFetch> MetadataCursor<'a, F> {
4346
}
4447
}
4548

49+
/// Create a new Metadata cursor at the specified offset
4650
pub fn new_with_offset(fetch: &'a F, endianness: Endianness, offset: u64) -> Self {
4751
Self {
4852
fetch,
@@ -51,11 +55,18 @@ impl<'a, F: MetadataFetch> MetadataCursor<'a, F> {
5155
}
5256
}
5357

58+
/// set the offset on this cursor
59+
///
60+
/// ```ignore
61+
/// use async_tiff::metadata::MetadataCursor;
62+
/// let cursor = MetadataCursor::new().with_offset(42);
63+
/// ```
5464
pub fn with_offset(mut self, offset: u64) -> Self {
5565
self.offset = offset;
5666
self
5767
}
5868

69+
/// seek to a pre-determined offset in the tiff
5970
pub fn seek(&mut self, offset: u64) {
6071
self.offset = offset;
6172
}

src/metadata/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@ pub mod cache;
6161
mod fetch;
6262
mod reader;
6363

64-
pub use fetch::{MetadataFetch, MetadataCursor};
64+
pub use fetch::{MetadataCursor, MetadataFetch};
6565
pub use reader::{ImageFileDirectoryReader, TiffMetadataReader};

src/metadata/reader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl ImageFileDirectoryReader {
262262
pub fn tag_count(&self) -> u64 {
263263
self.tag_count
264264
}
265-
265+
266266
/// The number of bytes that each IFD entry takes up.
267267
/// This is 12 bytes for normal TIFF and 20 bytes for BigTIFF.
268268
pub fn ifd_entry_byte_size(&self) -> u64 {

0 commit comments

Comments
 (0)