pub struct StyleExpressionHandle { /* private fields */ }Expand description
Implementations§
Source§impl StyleExpressionHandle
impl StyleExpressionHandle
Sourcepub fn create(
expression: &str,
options: Option<&StyleExpressionOptions>,
) -> Result<StyleExpressionHandle>
pub fn create( expression: &str, options: Option<&StyleExpressionOptions>, ) -> Result<StyleExpressionHandle>
Parses a style [expression](https://maplibre.org/maplibre-style-spec/expressions/) to evaluate without a map.
See mln_style_expression_create in the
C API reference.
§Errors
Status::InvalidArgumentwhenexpressionisn’t a valid expression, or its result can’t have the expected type.
Sourcepub fn evaluate(
&self,
inputs: Option<&StyleExpressionInputs<'_>>,
) -> Result<String>
pub fn evaluate( &self, inputs: Option<&StyleExpressionInputs<'_>>, ) -> Result<String>
Evaluates a style expression and writes its result as JSON.
A number in the result that isn’t finite becomes null. A color is
["rgba", r, g, b, a], with red, green, and blue from 0 to 255 and
alpha from 0 to 1, each exact only to single precision. Formatted text
is a ["format", …] expression, an image is {"name": …, "available": …}, padding is [top, right, bottom, left], and a variable anchor
offset is [anchor, [x, y], …].
See mln_style_expression_evaluate in the
C API reference.
§Errors
Status::InvalidArgumentwhen the expression fails to evaluate, such as when it reads an input thatinputsdoesn’t set.
Sourcepub fn get_info(&self) -> Result<StyleExpressionInfo>
pub fn get_info(&self) -> Result<StyleExpressionInfo>
Reads what a style expression’s result depends on.
See mln_style_expression_get_info in the
C API reference.
Sourcepub fn release(self) -> Result<(), ReleaseError<Self>>
pub fn release(self) -> Result<(), ReleaseError<Self>>
Releases a parsed style expression.
See mln_style_expression_release in the
C API reference.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StyleExpressionHandle
impl RefUnwindSafe for StyleExpressionHandle
impl Send for StyleExpressionHandle
impl Sync for StyleExpressionHandle
impl Unpin for StyleExpressionHandle
impl UnsafeUnpin for StyleExpressionHandle
impl UnwindSafe for StyleExpressionHandle
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more