pub trait Context {
// Required methods
fn new() -> Self
where Self: Sized;
fn op(&mut self, definition: &str) -> Result<OpHandle, Error>;
fn apply(
&self,
op: OpHandle,
direction: Direction,
operands: &mut dyn CoordinateSet
) -> Result<usize, Error>;
fn globals(&self) -> BTreeMap<String, String>;
fn steps(&self, op: OpHandle) -> Result<&Vec<String>, Error>;
fn params(
&self,
op: OpHandle,
index: usize
) -> Result<ParsedParameters, Error>;
fn register_op(&mut self, name: &str, constructor: OpConstructor);
fn register_resource(&mut self, name: &str, definition: &str);
fn get_op(&self, name: &str) -> Result<OpConstructor, Error>;
fn get_resource(&self, name: &str) -> Result<String, Error>;
fn get_blob(&self, name: &str) -> Result<Vec<u8>, Error>;
fn get_grid(&self, name: &str) -> Result<Arc<dyn Grid>, Error>;
}
Expand description
Modes of communication between the Rust Geodesy internals and the external world (i.e. resources like grids, transformation definitions, or ellipsoid parameters).
Required Methods§
sourcefn new() -> Selfwhere
Self: Sized,
fn new() -> Selfwhere
Self: Sized,
In general, implementations should make sure that new
differs from default
only by adding access to the builtin adaptors (geo:in
, gis:out
etc.)
sourcefn op(&mut self, definition: &str) -> Result<OpHandle, Error>
fn op(&mut self, definition: &str) -> Result<OpHandle, Error>
Instantiate the operation given by definition
sourcefn apply(
&self,
op: OpHandle,
direction: Direction,
operands: &mut dyn CoordinateSet
) -> Result<usize, Error>
fn apply( &self, op: OpHandle, direction: Direction, operands: &mut dyn CoordinateSet ) -> Result<usize, Error>
Apply operation op
to operands
sourcefn globals(&self) -> BTreeMap<String, String>
fn globals(&self) -> BTreeMap<String, String>
Globally defined default values (typically just ellps=GRS80
)
sourcefn params(&self, op: OpHandle, index: usize) -> Result<ParsedParameters, Error>
fn params(&self, op: OpHandle, index: usize) -> Result<ParsedParameters, Error>
Parsed parameters of a specific step
sourcefn register_op(&mut self, name: &str, constructor: OpConstructor)
fn register_op(&mut self, name: &str, constructor: OpConstructor)
Register a new user-defined operator
sourcefn register_resource(&mut self, name: &str, definition: &str)
fn register_resource(&mut self, name: &str, definition: &str)
Register a new user-defined resource (macro, ellipsoid parameter set…)
sourcefn get_op(&self, name: &str) -> Result<OpConstructor, Error>
fn get_op(&self, name: &str) -> Result<OpConstructor, Error>
Helper for the Op
instantiation logic in Op::op(...)
sourcefn get_resource(&self, name: &str) -> Result<String, Error>
fn get_resource(&self, name: &str) -> Result<String, Error>
Helper for the Op
instantiation logic in Op::op(...)