pub struct SchemaUri(/* private fields */);Expand description
A validated SCIM schema URI.
SchemaUri represents a unique identifier for a SCIM schema. It enforces validation rules at construction time, ensuring that only valid schema URIs can exist in the system.
§Validation Rules
- Must not be empty
- Must start with “urn:” prefix
- Must contain “scim:schemas” to be a valid SCIM schema URI
§Examples
use scim_server::resource::value_objects::SchemaUri;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Valid schema URI
let uri = SchemaUri::new("urn:ietf:params:scim:schemas:core:2.0:User".to_string())?;
println!("Schema URI: {}", uri.as_str());
// Invalid schema URI - returns ValidationError
let invalid = SchemaUri::new("http://example.com".to_string());
assert!(invalid.is_err());
Ok(())
}Implementations§
Source§impl SchemaUri
impl SchemaUri
Sourcepub fn new(value: String) -> ValidationResult<Self>
pub fn new(value: String) -> ValidationResult<Self>
Create a new SchemaUri with validation.
This is the primary constructor that enforces all validation rules. Use this method when creating SchemaUri instances from untrusted input.
§Arguments
value- The string value to validate and wrap
§Returns
Ok(SchemaUri)- If the value is validErr(ValidationError)- If the value violates validation rules
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Get the owned string value of the SchemaUri.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SchemaUri
impl<'de> Deserialize<'de> for SchemaUri
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl TryFrom<&str> for SchemaUri
impl TryFrom<&str> for SchemaUri
Source§type Error = ValidationError
type Error = ValidationError
The type returned in the event of a conversion error.
Source§fn try_from(value: &str) -> ValidationResult<Self>
fn try_from(value: &str) -> ValidationResult<Self>
Performs the conversion.
Source§impl TryFrom<String> for SchemaUri
impl TryFrom<String> for SchemaUri
Source§type Error = ValidationError
type Error = ValidationError
The type returned in the event of a conversion error.
Source§fn try_from(value: String) -> ValidationResult<Self>
fn try_from(value: String) -> ValidationResult<Self>
Performs the conversion.
impl Eq for SchemaUri
impl StructuralPartialEq for SchemaUri
Auto Trait Implementations§
impl Freeze for SchemaUri
impl RefUnwindSafe for SchemaUri
impl Send for SchemaUri
impl Sync for SchemaUri
impl Unpin for SchemaUri
impl UnwindSafe for SchemaUri
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> TenantValidator for T
impl<T> TenantValidator for T
Source§fn validate_tenant_context(
&self,
expected_tenant_id: &str,
context: &RequestContext,
) -> Result<(), String>
fn validate_tenant_context( &self, expected_tenant_id: &str, context: &RequestContext, ) -> Result<(), String>
Validate that the context has the expected tenant.
Source§fn validate_single_tenant_context(
&self,
context: &RequestContext,
) -> Result<(), String>
fn validate_single_tenant_context( &self, context: &RequestContext, ) -> Result<(), String>
Validate that the context is for single-tenant operation.
Source§fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>
fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>
Extract tenant context or return error for multi-tenant operations.