Struct gdal::vector::Feature

source ·
pub struct Feature<'a> { /* private fields */ }
Expand description

OGR Feature

Implementations§

source§

impl<'a> Feature<'a>

source

pub fn new(defn: &'a Defn) -> Result<Feature<'_>>

source

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

source

pub unsafe fn c_feature(&self) -> OGRFeatureH

Returns the C wrapped pointer

Safety

This method returns a raw C pointer

source

pub fn _lazy_feature_geometries(defn: &'a Defn) -> Vec<Geometry>

source

pub fn fid(&self) -> Option<u64>

Returns the feature identifier, or None if none has been assigned.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

pub fn geometry(&self) -> Option<&Geometry>

Get the feature’s geometry.

source

pub fn geometry_by_name(&self, field_name: &str) -> Result<&Geometry>

source

pub fn geometry_by_index(&self, idx: usize) -> Result<&Geometry>

source

pub fn create<L: LayerAccess>(&self, lyr: &L) -> Result<()>

source

pub fn set_field_string(&self, field_name: &str, value: &str) -> Result<()>

source

pub fn set_field_string_list( &self, field_name: &str, value: &[&str] ) -> Result<()>

source

pub fn set_field_double(&self, field_name: &str, value: f64) -> Result<()>

source

pub fn set_field_double_list( &self, field_name: &str, value: &[f64] ) -> Result<()>

source

pub fn set_field_integer(&self, field_name: &str, value: i32) -> Result<()>

source

pub fn set_field_integer_list( &self, field_name: &str, value: &[i32] ) -> Result<()>

source

pub fn set_field_integer64(&self, field_name: &str, value: i64) -> Result<()>

source

pub fn set_field_integer64_list( &self, field_name: &str, value: &[i64] ) -> Result<()>

source

pub fn set_field_datetime( &self, field_name: &str, value: DateTime<FixedOffset> ) -> Result<()>

source

pub fn set_field(&self, field_name: &str, value: &FieldValue) -> Result<()>

source

pub fn set_geometry(&mut self, geom: Geometry) -> Result<()>

source

pub fn field_count(&self) -> i32

source

pub fn fields(&self) -> FieldValueIterator<'_>

Trait Implementations§

source§

impl<'a> Debug for Feature<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Drop for Feature<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Feature<'a>

§

impl<'a> !Send for Feature<'a>

§

impl<'a> !Sync for Feature<'a>

§

impl<'a> Unpin for Feature<'a>

§

impl<'a> UnwindSafe for Feature<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.