pub struct Feature<'a> { /* private fields */ }
Expand description
OGR Feature
Implementations
sourceimpl<'a> Feature<'a>
impl<'a> Feature<'a>
pub fn new(defn: &'a Defn) -> Result<Feature<'_>>
sourcepub unsafe fn from_c_feature(
defn: &'a Defn,
c_feature: OGRFeatureH
) -> Feature<'_>
pub unsafe fn from_c_feature(
defn: &'a Defn,
c_feature: OGRFeatureH
) -> Feature<'_>
Creates a new Feature by wrapping a C pointer and a Defn
Safety
This method operates on a raw C pointer
sourcepub unsafe fn c_feature(&self) -> OGRFeatureH
pub unsafe fn c_feature(&self) -> OGRFeatureH
pub fn _lazy_feature_geometries(defn: &'a Defn) -> Vec<Geometry>
sourcepub fn fid(&self) -> Option<u64>
pub fn fid(&self) -> Option<u64>
Returns the feature identifier, or None
if none has been assigned.
sourcepub fn field<S: AsRef<str>>(&self, name: S) -> Result<Option<FieldValue>>
pub fn field<S: AsRef<str>>(&self, name: S) -> Result<Option<FieldValue>>
Get the value of a named field. If the field exists, it returns a FieldValue
wrapper,
that you need to unpack to a base type (string, float, etc).
If the field is missing, returns GdalError::InvalidFieldName
.
If the field has an unsupported type, returns a GdalError::UnhandledFieldType
.
If the field is null, returns None
.
sourcepub fn field_as_integer(&self, field_idx: i32) -> Result<Option<i32>>
pub fn field_as_integer(&self, field_idx: i32) -> Result<Option<i32>>
Get the value of the specified field as a i32
.
If the field is missing, returns GdalError::InvalidFieldIndex
.
Returns Ok(None)
if the field is null.
Returns Ok(Some(0))
on other kinds of errors.
sourcepub fn field_as_integer_by_name(&self, field_name: &str) -> Result<Option<i32>>
pub fn field_as_integer_by_name(&self, field_name: &str) -> Result<Option<i32>>
Get the value of the specified field as a i32
.
If the field is missing, returns GdalError::InvalidFieldName
.
Returns Ok(None)
if the field is null.
Returns Ok(Some(0))
on other kinds of errors.
sourcepub fn field_as_integer64_by_name(&self, field_name: &str) -> Result<Option<i64>>
pub fn field_as_integer64_by_name(&self, field_name: &str) -> Result<Option<i64>>
Get the value of the specified field as a i64
.
If the field is missing, returns GdalError::InvalidFieldName
.
Returns Ok(None)
if the field is null.
Returns Ok(Some(0))
on other kinds of errors.
sourcepub fn field_as_integer64(&self, field_idx: i32) -> Result<Option<i64>>
pub fn field_as_integer64(&self, field_idx: i32) -> Result<Option<i64>>
Get the value of the specified field as a i64
.
If the field is missing, returns GdalError::InvalidFieldIndex
.
Returns Ok(None)
if the field is null.
Returns Ok(Some(0))
on other kinds of errors.
sourcepub fn field_as_double_by_name(&self, field_name: &str) -> Result<Option<f64>>
pub fn field_as_double_by_name(&self, field_name: &str) -> Result<Option<f64>>
Get the value of the specified field as a f64
.
If the field is missing, returns GdalError::InvalidFieldName
.
Returns Ok(None)
if the field is null.
Returns Ok(Some(0.))
on other kinds of errors.
sourcepub fn field_as_double(&self, field_idx: i32) -> Result<Option<f64>>
pub fn field_as_double(&self, field_idx: i32) -> Result<Option<f64>>
Get the value of the specified field as a f64
.
If the field is missing, returns GdalError::InvalidFieldIndex
.
Returns Ok(None)
if the field is null.
Returns Ok(Some(0.))
on other kinds of errors.
sourcepub fn field_as_string_by_name(&self, field_name: &str) -> Result<Option<String>>
pub fn field_as_string_by_name(&self, field_name: &str) -> Result<Option<String>>
Get the value of the specified field as a String
.
If the field is missing, returns GdalError::InvalidFieldName
.
Returns Ok(None)
if the field is null.
sourcepub fn field_as_string(&self, field_idx: i32) -> Result<Option<String>>
pub fn field_as_string(&self, field_idx: i32) -> Result<Option<String>>
Get the value of the specified field as a String
.
If the field is missing, returns GdalError::InvalidFieldIndex
.
Returns Ok(None)
if the field is null.
sourcepub fn field_as_datetime_by_name(
&self,
field_name: &str
) -> Result<Option<DateTime<FixedOffset>>>
pub fn field_as_datetime_by_name(
&self,
field_name: &str
) -> Result<Option<DateTime<FixedOffset>>>
Get the value of the specified field as a DateTime<FixedOffset>
.
If the field is missing, returns GdalError::InvalidFieldName
.
Returns Ok(None)
if the field is null.
sourcepub fn field_as_datetime(
&self,
field_idx: i32
) -> Result<Option<DateTime<FixedOffset>>>
pub fn field_as_datetime(
&self,
field_idx: i32
) -> Result<Option<DateTime<FixedOffset>>>
Get the value of the specified field as a DateTime<FixedOffset>
.
If the field is missing, returns GdalError::InvalidFieldIndex
.
Returns Ok(None)
if the field is null.