Struct pasture_io::base::IOFactory[][src]

pub struct IOFactory { /* fields omitted */ }

Factory that can create PointReader and PointWriter objects based on file extensions. Use this if you have a file path and just want to create a PointReader or PointWriter from this path, without knowing the type of file. The Default implementation supports all file formats that Pasture natively works with, custom formats can be registered using the register_... functions

Implementations

impl IOFactory[src]

pub fn make_reader(&self, file: &Path) -> Result<Box<dyn PointReadAndSeek>>[src]

Try to create a PointReader that can read from the given file. This function will fail if file has a format that is unsupported by Pasture, or if there are any I/O errors while trying to access file.

pub fn make_writer(&self, file: &Path) -> Result<Box<dyn PointWriter>>[src]

Try to create a PointWriter for writing into the given file. This function will fail if file has a format that is unsupported by Pasture, or if there are any I/O errors while trying to access file.

pub fn supports_reading_from(&self, extension: &'static str) -> bool[src]

Returns true if the associated IOFactory supports creating PointReader objects for the given file extension

pub fn supports_writing_to(&self, extension: &'static str) -> bool[src]

Returns true if the associated IOFactory supports creating PointWriter objects for the given file extension

pub fn register_reader_for_extension<F: Fn(&Path) -> Result<Box<dyn PointReadAndSeek>> + 'static>(
    &mut self,
    extension: &'static str,
    reader_factory: F
) -> Option<Box<dyn Fn(&Path) -> Result<Box<dyn PointReadAndSeek>>>>
[src]

Register a new readable file extension with the associated IOFactory. The reader_factory will be called whenever extension is encountered as a file extension in make_reader. Returns the previous reader factory function that was registered for extension, if there was any.

pub fn register_writer_for_extension<F: Fn(&Path) -> Result<Box<dyn PointWriter>> + 'static>(
    &mut self,
    extension: &'static str,
    writer_factory: F
) -> Option<Box<dyn Fn(&Path) -> Result<Box<dyn PointWriter>>>>
[src]

Register a new writeable file extension with the associated IOFactory. The writer_factory will be called whenever extension is encountered as a file extension in make_writer. Returns the previous writer factory function that was registered for extension, if there was any.

Trait Implementations

impl Default for IOFactory[src]

Auto Trait Implementations

impl !RefUnwindSafe for IOFactory

impl !Send for IOFactory

impl !Sync for IOFactory

impl Unpin for IOFactory

impl !UnwindSafe for IOFactory

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

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,