pub struct SchemaDiscovery<State = Ready> { /* private fields */ }Expand description
Schema discovery component with state machine design.
The component uses phantom types to encode its configuration state at compile time, preventing invalid operations and ensuring proper initialization sequence. This component is specifically designed for schema discovery and service provider configuration, not for resource CRUD operations.
§Type Parameters
State- The current state of the component (Uninitialized or Ready)
§Example
use scim_server::SchemaDiscovery;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a schema discovery component
let discovery = SchemaDiscovery::new()?;
// Get available schemas
let schemas = discovery.get_schemas().await?;
println!("Available schemas: {}", schemas.len());
// For resource CRUD operations, use ScimServer instead
Ok(())
}Implementations§
Source§impl SchemaDiscovery<Uninitialized>
impl SchemaDiscovery<Uninitialized>
Sourcepub fn new() -> BuildResult<SchemaDiscovery<Ready>>
pub fn new() -> BuildResult<SchemaDiscovery<Ready>>
Create a new schema discovery component.
This creates a component with default configuration and schema registry for schema discovery and service provider configuration. For resource CRUD operations, use ScimServer instead.
Source§impl SchemaDiscovery<Ready>
impl SchemaDiscovery<Ready>
Sourcepub async fn get_schemas(&self) -> ScimResult<Vec<Schema>>
pub async fn get_schemas(&self) -> ScimResult<Vec<Schema>>
Get all available schemas.
Returns the complete list of schemas supported by this component instance. For the MVP, this includes only the core User schema.
Sourcepub async fn get_schema(&self, id: &str) -> ScimResult<Option<Schema>>
pub async fn get_schema(&self, id: &str) -> ScimResult<Option<Schema>>
Sourcepub async fn get_service_provider_config(
&self,
) -> ScimResult<ServiceProviderConfig>
pub async fn get_service_provider_config( &self, ) -> ScimResult<ServiceProviderConfig>
Get the service provider configuration.
Returns the capabilities and configuration of this SCIM service provider as defined in RFC 7644.
Sourcepub fn schema_registry(&self) -> &SchemaRegistry
pub fn schema_registry(&self) -> &SchemaRegistry
Get the schema registry for advanced usage.
This provides access to the underlying schema registry for custom validation or schema introspection.
Sourcepub fn service_config(&self) -> &ServiceProviderConfig
pub fn service_config(&self) -> &ServiceProviderConfig
Get the service provider configuration.
Trait Implementations§
Auto Trait Implementations§
impl<State> Freeze for SchemaDiscovery<State>
impl<State> RefUnwindSafe for SchemaDiscovery<State>where
State: RefUnwindSafe,
impl<State> Send for SchemaDiscovery<State>where
State: Send,
impl<State> Sync for SchemaDiscovery<State>where
State: Sync,
impl<State> Unpin for SchemaDiscovery<State>where
State: Unpin,
impl<State> UnwindSafe for SchemaDiscovery<State>where
State: UnwindSafe,
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
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>
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