Trait wkb::WKBAbleExt [−][src]
pub trait WKBAbleExt { fn write_as_wkb(&self, w: &mut impl Write) -> Result<(), WKBWriteError>; fn read_from_wkb(r: &mut impl Read) -> Result<Self, WKBReadError>
where
Self: Sized; fn as_wkb_bytes(&self) -> Vec<u8> { ... } }
A thing (Geometry
) that can be read or written as WKB
use geo_types::*; use wkb::*; let p: Geometry<f64> = Geometry::Point(Point::new(2., 4.)); let mut bytes = Vec::new(); p.write_as_wkb(&mut bytes).unwrap(); assert_eq!(bytes, vec![1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 16, 64]); //let p2 = Point::new(2., 4.); //let mut bytes = Vec::new(); //p2.write_as_wkb(&mut bytes).unwrap(); //assert_eq!(bytes, vec![1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 16, 64]);
Required methods
fn write_as_wkb(&self, w: &mut impl Write) -> Result<(), WKBWriteError>
[src]
Attempt to write self as WKB to a Write
.
fn read_from_wkb(r: &mut impl Read) -> Result<Self, WKBReadError> where
Self: Sized,
[src]
Self: Sized,
Attempt to read an instance of self from this Read
.
Provided methods
fn as_wkb_bytes(&self) -> Vec<u8>
[src]
Return self as WKB bytes