pub struct FeaturesServer {
pub title: String,
pub description: String,
pub base_url: String,
pub collections: Vec<Collection>,
}Expand description
Stateless request handler for OGC API - Features endpoints
Fields§
§title: StringService title
description: StringService description
base_url: StringBase URL (e.g. "https://example.com/ogcapi")
collections: Vec<Collection>Registered collections
Implementations§
Source§impl FeaturesServer
impl FeaturesServer
Sourcepub fn new(title: impl Into<String>, base_url: impl Into<String>) -> Self
pub fn new(title: impl Into<String>, base_url: impl Into<String>) -> Self
Create a new server with the given title and base URL.
Sourcepub fn add_collection(&mut self, collection: Collection)
pub fn add_collection(&mut self, collection: Collection)
Register a collection.
Sourcepub fn landing_page(&self) -> LandingPage
pub fn landing_page(&self) -> LandingPage
Build the landing page response.
Sourcepub fn conformance(&self) -> ConformanceClasses
pub fn conformance(&self) -> ConformanceClasses
Build the conformance declaration response (Part 1 + Part 2).
Sourcepub fn list_collections(&self) -> Collections
pub fn list_collections(&self) -> Collections
Build the collections listing response.
Sourcepub fn get_collection(&self, id: &str) -> Option<&Collection>
pub fn get_collection(&self, id: &str) -> Option<&Collection>
Look up a collection by id.
Sourcepub fn build_items_response(
&self,
collection_id: &str,
features: Vec<Feature>,
params: &QueryParams,
total_matched: Option<u64>,
) -> Result<FeatureCollection, FeaturesError>
pub fn build_items_response( &self, collection_id: &str, features: Vec<Feature>, params: &QueryParams, total_matched: Option<u64>, ) -> Result<FeatureCollection, FeaturesError>
Build a paginated FeatureCollection response.
The caller supplies the full features vector (already filtered but not
yet paginated) together with total_matched (which may differ when
server-side filtering is applied outside this function).
This function:
- Validates the limit against
MAX_LIMIT. - Returns
FeaturesError::CollectionNotFoundif the collection is not registered. - Applies offset / limit slicing.
- Attaches
numberMatched,numberReturned, andtimeStamp. - Attaches
nextandprevpagination links.
Auto Trait Implementations§
impl Freeze for FeaturesServer
impl RefUnwindSafe for FeaturesServer
impl Send for FeaturesServer
impl Sync for FeaturesServer
impl Unpin for FeaturesServer
impl UnsafeUnpin for FeaturesServer
impl UnwindSafe for FeaturesServer
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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