[][src]Struct netcdf::file::MutableFile

pub struct MutableFile(_);

Mutable access to file

Implementations

impl MutableFile[src]

pub fn root_mut(&mut self) -> Option<GroupMut<'_>>[src]

Mutable access to the root group

Return None if this can't be a root group

pub fn variable_mut<'f>(&'f mut self, name: &str) -> Option<VariableMut<'f>>[src]

Get a mutable variable from the group

pub fn variables_mut(&mut self) -> impl Iterator<Item = VariableMut<'_>>[src]

Iterate over all variables in the root group, with mutable access

Examples

Use this to get multiple writable variables

let mut file = netcdf::append("file.nc")?;
let mut vars = file.variables_mut().collect::<Vec<_>>();
vars[0].put_value(1_u8, Some(&[2, 5]))?;
vars[1].put_value(1_u8, Some(&[5, 2]))?;

pub fn group_mut<'f>(&'f mut self, name: &str) -> Result<Option<GroupMut<'f>>>[src]

Mutable access to subgroup

Errors

File does not support groups

pub fn groups_mut<'f>(
    &'f mut self
) -> Result<impl Iterator<Item = GroupMut<'f>>>
[src]

Iterator over all groups (mutable access)

Errors

File does not support groups

pub fn add_attribute<'a, T>(
    &'a mut self,
    name: &str,
    val: T
) -> Result<Attribute<'a>> where
    T: Into<AttrValue>, 
[src]

Add an attribute to the root group

pub fn add_dimension<'f>(
    &'f mut self,
    name: &str,
    len: usize
) -> Result<Dimension<'f>>
[src]

Adds a dimension with the given name and size. A size of zero gives an unlimited dimension

pub fn add_unlimited_dimension(&mut self, name: &str) -> Result<Dimension<'_>>[src]

Adds a dimension with unbounded size

pub fn add_group<'f>(&'f mut self, name: &str) -> Result<GroupMut<'f>>[src]

Add an empty group to the dataset

pub fn add_variable<'f, T>(
    &'f mut self,
    name: &str,
    dims: &[&str]
) -> Result<VariableMut<'f>> where
    T: Numeric
[src]

Create a Variable into the dataset, with no data written into it

Dimensions are identified using the name of the dimension, and will recurse upwards if not found in the current group.

pub fn add_variable_with_type<'f>(
    &'f mut self,
    name: &str,
    dims: &[&str],
    typ: &VariableType
) -> Result<VariableMut<'f>>
[src]

Create a variable with the specified type

pub fn add_opaque_type<'f>(
    &'f mut self,
    name: &str,
    size: usize
) -> Result<OpaqueType>
[src]

Add an opaque datatype, with size bytes

pub fn add_vlen_type<'f, T: Numeric>(
    &'f mut self,
    name: &str
) -> Result<VlenType>
[src]

Add a variable length datatype

pub fn add_enum_type<'f, T: Numeric>(
    &'f mut self,
    name: &str,
    mappings: &[(&str, T)]
) -> Result<EnumType>
[src]

Add an enum datatype

pub fn add_compound_type(&mut self, name: &str) -> Result<CompoundBuilder>[src]

Build a compound type

pub fn add_string_variable<'f>(
    &'f mut self,
    name: &str,
    dims: &[&str]
) -> Result<VariableMut<'f>>
[src]

Adds a variable with a basic type of string

pub fn add_variable_from_identifiers<'f, T>(
    &'f mut self,
    name: &str,
    dims: &[Identifier]
) -> Result<VariableMut<'f>> where
    T: Numeric
[src]

Adds a variable from a set of unique identifiers, recursing upwards from the current group if necessary.

Methods from Deref<Target = File>

pub fn path(&self) -> Result<PathBuf>[src]

path used to open/create the file

#Errors

Netcdf layer could fail, or the resulting path could contain an invalid UTF8 sequence

pub fn root(&self) -> Option<Group<'_>>[src]

Main entrypoint for interacting with the netcdf file.

pub fn variable<'f>(&'f self, name: &str) -> Option<Variable<'f>>[src]

Get a variable from the group

pub fn variables(&self) -> impl Iterator<Item = Variable<'_>>[src]

Iterate over all variables in a group

pub fn attribute<'f>(&'f self, name: &str) -> Option<Attribute<'f>>[src]

Get a single attribute

pub fn attributes(&self) -> impl Iterator<Item = Attribute<'_>>[src]

Get all attributes in the root group

pub fn dimension<'f>(&self, name: &str) -> Option<Dimension<'f>>[src]

Get a single dimension

pub fn dimensions(&self) -> impl Iterator<Item = Dimension<'_>>[src]

Iterator over all dimensions in the root group

pub fn group<'f>(&'f self, name: &str) -> Result<Option<Group<'f>>>[src]

Get a group

Errors

Not a netCDF-4 file

pub fn groups<'f>(&'f self) -> Result<impl Iterator<Item = Group<'f>>>[src]

Iterator over all subgroups in the root group

Errors

Not a netCDF-4 file

pub fn types(&self) -> Result<impl Iterator<Item = VariableType>>[src]

Return all types in the root group

Trait Implementations

impl Debug for MutableFile[src]

impl Deref for MutableFile[src]

type Target = File

The resulting type after dereferencing.

Auto Trait Implementations

impl RefUnwindSafe for MutableFile

impl Send for MutableFile

impl Sync for MutableFile

impl Unpin for MutableFile

impl UnwindSafe for MutableFile

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.