[−][src]Struct netcdf::variable::VariableMut
Mutable access to a variable.
Implementations
impl<'g> VariableMut<'g>
[src]
pub fn compression(&mut self, deflate_level: nc_type) -> Result<()>
[src]
Sets compression on the variable. Must be set before filling in data.
deflate_level
can take a value 0..=9, with 0 being no
compression (good for CPU bound tasks), and 9 providing the
highest compression level (good for memory bound tasks)
Errors
Not a netcdf-4
file or deflate_level
not valid
pub fn chunking(&mut self, chunksize: &[usize]) -> Result<()>
[src]
Set chunking for variable. Must be set before inserting data
Use this when reading or writing smaller units of the hypercube than the full dimensions lengths, to change how the variable is stored in the file. This has no effect on the memory order when reading/putting a buffer.
Errors
Not a netCDF-4
file or invalid chunksize
impl<'g> VariableMut<'g>
[src]
pub fn add_attribute<T>(&mut self, name: &str, val: T) -> Result<Attribute<'_>> where
T: Into<AttrValue>,
[src]
T: Into<AttrValue>,
Adds an attribute to the variable
impl<'g> VariableMut<'g>
[src]
pub fn put_value<T: Numeric>(
&mut self,
value: T,
indices: Option<&[usize]>
) -> Result<()>
[src]
&mut self,
value: T,
indices: Option<&[usize]>
) -> Result<()>
Put a single value at indices
pub fn put_string(
&mut self,
value: &str,
indices: Option<&[usize]>
) -> Result<()>
[src]
&mut self,
value: &str,
indices: Option<&[usize]>
) -> Result<()>
Internally converts to a CString
, avoid using this function when performance
is important
pub fn put_values<T: Numeric>(
&mut self,
values: &[T],
indices: Option<&[usize]>,
slice_len: Option<&[usize]>
) -> Result<()>
[src]
&mut self,
values: &[T],
indices: Option<&[usize]>,
slice_len: Option<&[usize]>
) -> Result<()>
Put a slice of values at indices
pub fn put_values_strided<T: Numeric>(
&mut self,
values: &[T],
indices: Option<&[usize]>,
slice_len: Option<&[usize]>,
strides: &[isize]
) -> Result<usize>
[src]
&mut self,
values: &[T],
indices: Option<&[usize]>,
slice_len: Option<&[usize]>,
strides: &[isize]
) -> Result<usize>
Put a slice of values at indices
, with destination strided
pub fn set_fill_value<T>(&mut self, fill_value: T) -> Result<()> where
T: Numeric,
[src]
T: Numeric,
pub unsafe fn set_nofill(&mut self) -> Result<()>
[src]
Set the fill value to no value. Use this when wanting to avoid duplicate writes into empty variables.
Errors
Not a netCDF-4
file
Safety
Reading from this variable after having defined nofill will read potentially uninitialized data. Normally one will expect to find some filler value
pub fn endian(&mut self, e: Endianness) -> Result<()>
[src]
Set endianness of the variable. Must be set before inserting data
endian
can take a Endianness
value with Native being NC_ENDIAN_NATIVE
(0),
Little NC_ENDIAN_LITTLE
(1), Big NC_ENDIAN_BIG
(2)
Errors
Not a netCDF-4
file, late define
pub unsafe fn put_raw_values(
&mut self,
buf: &[u8],
start: &[usize],
count: &[usize]
) -> Result<()>
[src]
&mut self,
buf: &[u8],
start: &[usize],
count: &[usize]
) -> Result<()>
Get values of any type as bytes
Safety
When working with compound types, variable length arrays and strings create pointers from the buffer, and tries to copy memory from these locations. Compound types which does not have these elements will be safe to access, and can treat this function as safe
pub fn put_vlen<T: Numeric>(&mut self, vec: &[T], index: &[usize]) -> Result<()>
[src]
Get a vlen element
Methods from Deref<Target = Variable<'g>>
pub fn name(&self) -> String
[src]
Get name of variable
pub fn attribute<'a>(&'a self, name: &str) -> Option<Attribute<'a>>
[src]
Get an attribute of this variable
pub fn attributes(&self) -> impl Iterator<Item = Attribute<'_>>
[src]
Iterator over all the attributes of this variable
pub fn dimensions(&self) -> &[Dimension<'_>]
[src]
Dimensions for a variable
pub fn vartype(&self) -> VariableType
[src]
Get the type of this variable
pub fn len(&self) -> usize
[src]
Get current length of the variable
pub fn endian_value(&self) -> Result<Endianness>
[src]
pub fn value<T: Numeric>(&self, indices: Option<&[usize]>) -> Result<T>
[src]
Fetches one specific value at specific indices indices must has the same length as self.dimensions.
pub fn string_value(&self, indices: Option<&[usize]>) -> Result<String>
[src]
Reads a string variable. This involves two copies per read, and should be avoided in performance critical code
pub fn values<T: Numeric>(
&self,
indices: Option<&[usize]>,
slice_len: Option<&[usize]>
) -> Result<ArrayD<T>>
[src]
&self,
indices: Option<&[usize]>,
slice_len: Option<&[usize]>
) -> Result<ArrayD<T>>
Fetches variable
pub fn fill_value<T: Numeric>(&self) -> Result<Option<T>>
[src]
Get the fill value of a variable
pub fn values_to<T: Numeric>(
&self,
buffer: &mut [T],
indices: Option<&[usize]>,
slice_len: Option<&[usize]>
) -> Result<()>
[src]
&self,
buffer: &mut [T],
indices: Option<&[usize]>,
slice_len: Option<&[usize]>
) -> Result<()>
Fetches variable into slice buffer must be able to hold all the requested elements
pub fn values_strided_to<T: Numeric>(
&self,
buffer: &mut [T],
indices: Option<&[usize]>,
slice_len: Option<&[usize]>,
strides: &[isize]
) -> Result<usize>
[src]
&self,
buffer: &mut [T],
indices: Option<&[usize]>,
slice_len: Option<&[usize]>,
strides: &[isize]
) -> Result<usize>
Fetches variable into slice buffer must be able to hold all the requested elements
pub fn raw_values(
&self,
buf: &mut [u8],
start: &[usize],
count: &[usize]
) -> Result<()>
[src]
&self,
buf: &mut [u8],
start: &[usize],
count: &[usize]
) -> Result<()>
Get values of any type as bytes, with no further interpretation of the values.
Note
When working with compound types, variable length arrays and
strings will be allocated in buf
, and this library will
not keep track of the allocations.
This can lead to memory leaks.
pub fn vlen<T: Numeric>(&self, index: &[usize]) -> Result<Vec<T>>
[src]
Get a vlen element
Trait Implementations
impl<'g> Debug for VariableMut<'g>
[src]
impl<'g> Deref for VariableMut<'g>
[src]
Auto Trait Implementations
impl<'g> RefUnwindSafe for VariableMut<'g>
impl<'g> Send for VariableMut<'g>
impl<'g> Sync for VariableMut<'g>
impl<'g> Unpin for VariableMut<'g>
impl<'g> !UnwindSafe for VariableMut<'g>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
[src]
const ALIGN: usize
[src]
type Init = T
The type for initializers.
unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
unsafe fn drop(ptr: usize)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,