pub struct Grib2<R> { /* private fields */ }
Implementations§
source§impl<R> Grib2<R>
impl<R> Grib2<R>
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of submessages in the data.
§Examples
fn main() -> Result<(), Box<dyn std::error::Error>> {
let f = std::fs::File::open(
"testdata/icon_global_icosahedral_single-level_2021112018_000_TOT_PREC.grib2",
)?;
let f = std::io::BufReader::new(f);
let grib2 = grib::from_reader(f)?;
assert_eq!(grib2.len(), 1);
Ok(())
}
sourcepub fn iter(&self) -> SubmessageIterator<'_, R> ⓘ
pub fn iter(&self) -> SubmessageIterator<'_, R> ⓘ
Returns an iterator over submessages in the data.
§Examples
fn main() -> Result<(), Box<dyn std::error::Error>> {
let f = std::fs::File::open(
"testdata/icon_global_icosahedral_single-level_2021112018_000_TOT_PREC.grib2",
)?;
let f = std::io::BufReader::new(f);
let grib2 = grib::from_reader(f)?;
let mut iter = grib2.iter();
let first = iter.next();
assert!(first.is_some());
let first = first.unwrap();
let (message_index, _) = first;
assert_eq!(message_index, (0, 0));
let second = iter.next();
assert!(second.is_none());
Ok(())
}
sourcepub fn submessages(&self) -> SubmessageIterator<'_, R> ⓘ
pub fn submessages(&self) -> SubmessageIterator<'_, R> ⓘ
Returns an iterator over submessages in the data.
This is an alias to Grib2::iter()
.
sourcepub fn sections(&self) -> Iter<'_, SectionInfo>
pub fn sections(&self) -> Iter<'_, SectionInfo>
Returns an iterator over sections in the data.
§Examples
fn main() -> Result<(), Box<dyn std::error::Error>> {
let f = std::fs::File::open(
"testdata/icon_global_icosahedral_single-level_2021112018_000_TOT_PREC.grib2",
)?;
let f = std::io::BufReader::new(f);
let grib2 = grib::from_reader(f)?;
let mut iter = grib2.sections();
let first = iter.next();
assert!(first.is_some());
let first = first.unwrap();
assert_eq!(first.num, 0);
let tenth = iter.nth(9);
assert!(tenth.is_none());
Ok(())
}
source§impl<R: Grib2Read> Grib2<R>
impl<R: Grib2Read> Grib2<R>
pub fn read(r: R) -> Result<Self, GribError>
pub fn read_with_seekable<SR: Read + Seek>( r: SR, ) -> Result<Grib2<SeekableGrib2Reader<SR>>, GribError>
pub fn list_templates(&self) -> Vec<TemplateInfo>
Trait Implementations§
source§impl<'a, R: 'a> IntoIterator for &'a Grib2<R>
impl<'a, R: 'a> IntoIterator for &'a Grib2<R>
Auto Trait Implementations§
impl<R> !Freeze for Grib2<R>
impl<R> !RefUnwindSafe for Grib2<R>
impl<R> Send for Grib2<R>where
R: Send,
impl<R> !Sync for Grib2<R>
impl<R> Unpin for Grib2<R>where
R: Unpin,
impl<R> UnwindSafe for Grib2<R>where
R: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more