Struct geos::ContextHandle
source · pub struct ContextHandle { /* private fields */ }
Implementations§
source§impl ContextHandle
impl ContextHandle
sourcepub fn init() -> GResult<Self>
pub fn init() -> GResult<Self>
Creates a new ContextHandle
.
§Example
use geos::ContextHandle;
let context_handle = ContextHandle::init().expect("invalid init");
sourcepub fn set_notice_message_handler(&self, nf: Option<HandlerCallback>)
pub fn set_notice_message_handler(&self, nf: Option<HandlerCallback>)
sourcepub fn set_error_message_handler(&self, ef: Option<HandlerCallback>)
pub fn set_error_message_handler(&self, ef: Option<HandlerCallback>)
sourcepub fn get_last_error(&self) -> Option<String>
pub fn get_last_error(&self) -> Option<String>
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!");
}
sourcepub fn get_last_notification(&self) -> Option<String>
pub fn get_last_notification(&self) -> Option<String>
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!");
}
sourcepub fn get_wkb_output_dimensions(&self) -> GResult<OutputDimension>
pub fn get_wkb_output_dimensions(&self) -> GResult<OutputDimension>
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));
sourcepub fn set_wkb_output_dimensions(
&mut self,
dimensions: OutputDimension
) -> GResult<OutputDimension>
pub fn set_wkb_output_dimensions( &mut self, dimensions: OutputDimension ) -> GResult<OutputDimension>
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));
sourcepub fn get_wkb_byte_order(&self) -> ByteOrder
pub fn get_wkb_byte_order(&self) -> ByteOrder
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);
sourcepub fn set_wkb_byte_order(&mut self, byte_order: ByteOrder) -> ByteOrder
pub fn set_wkb_byte_order(&mut self, byte_order: ByteOrder) -> ByteOrder
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§
Auto Trait Implementations§
impl Freeze for ContextHandle
impl RefUnwindSafe for ContextHandle
impl Send for ContextHandle
impl Sync for ContextHandle
impl Unpin for ContextHandle
impl UnwindSafe for ContextHandle
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more