pub struct LayerDefinition { /* private fields */ }Expand description
Layer definition within a Feature Service.
§ESRI Documentation
Source: https://developers.arcgis.com/rest/services-reference/enterprise/layer-feature-service/
Required properties:
id: Layer ID (unique within service)name: Layer namegeometryType: Type of geometryfields: Field definitions (must include an ObjectID field)
Implementations§
Source§impl LayerDefinition
Auto-generated by derive_getters::Getters.
impl LayerDefinition
Auto-generated by derive_getters::Getters.
Sourcepub fn layer_type(&self) -> &Option<String>
pub fn layer_type(&self) -> &Option<String>
Layer type.
Common value: “Feature Layer”. Other options: “Table”.
Sourcepub fn geometry_type(&self) -> &GeometryTypeDefinition
pub fn geometry_type(&self) -> &GeometryTypeDefinition
Geometry type for this layer.
Sourcepub fn fields(&self) -> &Vec<FieldDefinition>
pub fn fields(&self) -> &Vec<FieldDefinition>
Field definitions.
Must include at least an ObjectID field.
Note: When deserializing from the service root endpoint (GET {serviceUrl}?f=json),
ESRI returns only layer stubs without field definitions. Use
FeatureServiceClient::get_layer_definition() to retrieve full field definitions.
Sourcepub fn object_id_field(&self) -> &Option<String>
pub fn object_id_field(&self) -> &Option<String>
Name of the ObjectID field.
Default: “OBJECTID”. Must match a field in fields array.
Sourcepub fn global_id_field(&self) -> &Option<String>
pub fn global_id_field(&self) -> &Option<String>
Name of the GlobalID field.
When present, enables features that depend on globally unique identifiers such as offline sync and relationship tracking.
Sourcepub fn display_field(&self) -> &Option<String>
pub fn display_field(&self) -> &Option<String>
Display field name (shown in popups).
Sourcepub fn description(&self) -> &Option<String>
pub fn description(&self) -> &Option<String>
Layer description.
Sourcepub fn copyright_text(&self) -> &Option<String>
pub fn copyright_text(&self) -> &Option<String>
Copyright text.
Sourcepub fn default_visibility(&self) -> &Option<bool>
pub fn default_visibility(&self) -> &Option<bool>
Default visibility.
Default: true.
Sourcepub fn templates(&self) -> &Vec<FeatureTemplate>
pub fn templates(&self) -> &Vec<FeatureTemplate>
Templates for feature creation.
Sourcepub fn indexes(&self) -> &Vec<Index>
pub fn indexes(&self) -> &Vec<Index>
Indexes on layer fields.
ESRI automatically creates indexes on ObjectID and geometry fields. Additional indexes can improve query performance on frequently-queried fields.
Sourcepub fn edit_fields_info(&self) -> &Option<EditFieldsInfo>
pub fn edit_fields_info(&self) -> &Option<EditFieldsInfo>
Editor tracking field configuration.
Specifies which fields track creation and edit information.
Sourcepub fn relationships(&self) -> &Vec<LayerRelationship>
pub fn relationships(&self) -> &Vec<LayerRelationship>
Relationship classes this layer participates in.
Each entry describes a relationship with another layer or table.
Sourcepub fn is_data_branch_versioned(&self) -> &Option<bool>
pub fn is_data_branch_versioned(&self) -> &Option<bool>
Whether data is branch versioned.
Read-only property returned by existing services. Branch versioning is configured through enterprise geodatabase administration, not through the REST API schema.
Source§impl LayerDefinition
impl LayerDefinition
Sourcepub fn validate(&self) -> Result<(), Vec<ServiceDefinitionValidationError>>
pub fn validate(&self) -> Result<(), Vec<ServiceDefinitionValidationError>>
Validates the layer definition against ESRI’s requirements.
Returns all validation errors found. An empty Ok(()) means the
definition is valid and safe to submit to the ESRI API.
§Validation Rules
- At least one
FieldType::Oidfield must be present - Exactly one ObjectID field (not multiple)
- ObjectID field must have
nullable: falseandeditable: false - If
is_data_branch_versionedistrue, aFieldType::GlobalIdfield is required - GlobalID field must have
nullable: falseandeditable: false - No duplicate field names (case-insensitive comparison)
object_id_field,global_id_field, anddisplay_fieldreferences must resolve
§Example
use arcgis::{LayerDefinitionBuilder, FieldDefinitionBuilder, FieldType, GeometryTypeDefinition};
let field = FieldDefinitionBuilder::default()
.name("OBJECTID")
.field_type(FieldType::Oid)
.nullable(false)
.editable(false)
.build()
.expect("Valid field");
let layer = LayerDefinitionBuilder::default()
.id(0u32)
.name("Buildings")
.geometry_type(GeometryTypeDefinition::Polygon)
.build()
.expect("Valid layer");
// Empty fields — will fail validation
assert!(layer.validate().is_err());Trait Implementations§
Source§impl Clone for LayerDefinition
impl Clone for LayerDefinition
Source§fn clone(&self) -> LayerDefinition
fn clone(&self) -> LayerDefinition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more