Struct las::writer::Writer

source ·
pub struct Writer<W: 'static + Write + Seek + Debug + Send> { /* private fields */ }
Expand description

Writes LAS data.

The LAS header needs to be re-written when the writer closes. For convenience, this is done via the Drop implementation of the writer. One consequence is that if the header re-write fails during the drop, a panic will result. If you want to check for errors instead of panicing, use close explicitly.

use std::io::Cursor;
use las::Writer;
{
    let mut writer = Writer::default();
    writer.close().unwrap();
} // <- `close` is not called

Implementations§

source§

impl<W: 'static + Write + Seek + Debug + Send> Writer<W>

source

pub fn new(dest: W, header: Header) -> Result<Self>

Creates a new writer.

The header that is passed in will have various fields zero’d, e.g. bounds, number of points, etc.

§Examples
use std::io::Cursor;
use las::Writer;
let writer = Writer::new(Cursor::new(Vec::new()), Default::default());
source

pub fn close(&mut self) -> Result<()>

Close this writer.

§Examples
use std::io::Cursor;
use las::Writer;
let mut writer = Writer::default();
writer.close().unwrap();
assert!(writer.close().is_err());
source§

impl<W: 'static + Write + Seek + Debug + Send> Writer<W>

source

pub fn into_inner(self) -> Result<W>

Closes this writer and returns its inner Write, seeked to the beginning of the las data.

§Examples
use las::Writer;
let writer = Writer::default();
let cursor = writer.into_inner().unwrap();
source§

impl Writer<BufWriter<File>>

source

pub fn from_path<P: AsRef<Path>>( path: P, header: Header ) -> Result<Writer<BufWriter<File>>>

Creates a new writer for a path.

If the “laz” feature is enabled, guesses from the extension if the data will be written compressed

§Examples
use las::Writer;
let writer = Writer::from_path("/dev/null", Default::default());

Trait Implementations§

source§

impl<W: Debug + 'static + Write + Seek + Debug + Send> Debug for Writer<W>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Writer<Cursor<Vec<u8>>>

source§

fn default() -> Writer<Cursor<Vec<u8>>>

Returns the “default value” for a type. Read more
source§

impl<W: 'static + Seek + Write + Debug + Send> Drop for Writer<W>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<W: 'static + Write + Seek + Debug + Send> Write for Writer<W>

source§

fn header(&self) -> &Header

Returns a reference to this writer’s header.

source§

fn write(&mut self, point: Point) -> Result<()>

Writes a point.

Auto Trait Implementations§

§

impl<W> Freeze for Writer<W>

§

impl<W> !RefUnwindSafe for Writer<W>

§

impl<W> Send for Writer<W>

§

impl<W> !Sync for Writer<W>

§

impl<W> Unpin for Writer<W>

§

impl<W> !UnwindSafe for Writer<W>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.