[][src]Struct geos::ContextHandle

pub struct ContextHandle<'a> { /* fields omitted */ }

Methods

impl<'a> ContextHandle<'a>[src]

pub fn init() -> GResult<Self>[src]

Creates a new ContextHandle.

Example

use geos::ContextHandle;

let context_handle = ContextHandle::init().expect("invalid init");

pub fn set_notice_message_handler(
    &self,
    nf: Option<Box<dyn Fn(&str) + Send + Sync + 'a>>
)
[src]

Allows to set a notice message handler.

Passing None as parameter will unset this callback.

Example

use geos::ContextHandle;

let context_handle = ContextHandle::init().expect("invalid init");

context_handle.set_notice_message_handler(Some(Box::new(|s| println!("new message: {}", s))));

pub fn set_error_message_handler(
    &self,
    ef: Option<Box<dyn Fn(&str) + Send + Sync + 'a>>
)
[src]

Allows to set an error message handler.

Passing None as parameter will unset this callback.

Example

use geos::ContextHandle;

let context_handle = ContextHandle::init().expect("invalid init");

context_handle.set_error_message_handler(Some(Box::new(|s| println!("new message: {}", s))));

pub fn get_last_error(&self) -> Option<String>[src]

Returns the last error encountered.

Please note that calling this function will remove the current last error!

use geos::ContextHandle;

let context_handle = ContextHandle::init().expect("invalid init");
// make some functions calls...
if let Some(last_error) = context_handle.get_last_error() {
    println!("We have an error: {}", last_error);
} else {
    println!("No error occurred!");
}

pub fn get_last_notification(&self) -> Option<String>[src]

Returns the last notification encountered.

Please note that calling this function will remove the current last notification!

use geos::ContextHandle;

let context_handle = ContextHandle::init().expect("invalid init");
// make some functions calls...
if let Some(last_notif) = context_handle.get_last_notification() {
    println!("We have a notification: {}", last_notif);
} else {
    println!("No notifications!");
}

pub fn get_wkb_output_dimensions(&self) -> GResult<OutputDimension>[src]

Gets WKB output dimensions.

Example

use geos::{ContextHandle, OutputDimension};

let mut context_handle = ContextHandle::init().expect("invalid init");

context_handle.set_wkb_output_dimensions(OutputDimension::TwoD);
assert_eq!(context_handle.get_wkb_output_dimensions(), Ok(OutputDimension::TwoD));

pub fn set_wkb_output_dimensions(
    &mut self,
    dimensions: OutputDimension
) -> GResult<OutputDimension>
[src]

Sets WKB output dimensions.

Example

use geos::{ContextHandle, OutputDimension};

let mut context_handle = ContextHandle::init().expect("invalid init");

context_handle.set_wkb_output_dimensions(OutputDimension::TwoD);
assert_eq!(context_handle.get_wkb_output_dimensions(), Ok(OutputDimension::TwoD));

pub fn get_wkb_byte_order(&self) -> ByteOrder[src]

Gets WKB byte order.

Example

use geos::{ContextHandle, ByteOrder};

let mut context_handle = ContextHandle::init().expect("invalid init");

context_handle.set_wkb_byte_order(ByteOrder::LittleEndian);
assert!(context_handle.get_wkb_byte_order() == ByteOrder::LittleEndian);

pub fn set_wkb_byte_order(&mut self, byte_order: ByteOrder) -> ByteOrder[src]

Sets WKB byte order.

Example

use geos::{ContextHandle, ByteOrder};

let mut context_handle = ContextHandle::init().expect("invalid init");

context_handle.set_wkb_byte_order(ByteOrder::LittleEndian);
assert!(context_handle.get_wkb_byte_order() == ByteOrder::LittleEndian);

Trait Implementations

impl<'a> Drop for ContextHandle<'a>[src]

Auto Trait Implementations

impl<'a> Send for ContextHandle<'a>

impl<'a> Sync for ContextHandle<'a>

Blanket Implementations

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

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

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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