pub struct ContextConfig {
pub country: Option<String>,
pub region: Option<String>,
pub industry: Option<String>,
pub compliance: Vec<String>,
}Expand description
Optional per-project context loaded from rustio.context.json.
The 0.6.0 shape covers four axes:
country— ISO-3166-1 alpha-2 ("SE","NO", …). Drives locale-aware naming (a Swedish project getspersonnummerfor “personal id”, not ani32).region— supra-national grouping ("EU"). Mostly inferred fromcountry; explicit setting is an override.industry—"housing","healthcare","banking". Picked up by the planner / review / executor so “patient id” underhealthcarebecomes aStringrather than ani32, and removing a convention field raises a warning.compliance— explicit list (["GDPR", "HIPAA"]). Empty by default; the helpers below treatregion=EUas implyingGDPReven when the list is empty.
#[serde(default, deny_unknown_fields)] keeps the wire contract
tight: a typo is a loud error, not a silent miss.
Breaking change vs 0.5.x: the old domain key is gone. If your
rustio.context.json still reads {"domain": "housing"}, rename
the key to industry.
Fields§
§country: Option<String>§region: Option<String>§industry: Option<String>§compliance: Vec<String>Implementations§
Source§impl ContextConfig
impl ContextConfig
pub fn parse(json: &str) -> Result<Self, PlanError>
Sourcepub fn effective_region(&self) -> Option<String>
pub fn effective_region(&self) -> Option<String>
Either the explicit region, or a best-effort inference from
country. Today we only know the EU list; other regions
(ASEAN, LATAM, MENA, …) fall through to None until projects
ask for them.
Sourcepub fn requires_gdpr(&self) -> bool
pub fn requires_gdpr(&self) -> bool
true if the project operates under the GDPR. Detected by
either (a) compliance listing "GDPR" explicitly, or
(b) the resolved region being "EU".
Sourcepub fn industry_schema(&self) -> Option<IndustrySchema>
pub fn industry_schema(&self) -> Option<IndustrySchema>
Look up the industry convention bundle for the selected industry
(case-insensitive). None if the project didn’t set one or the
name isn’t in the registry.
Sourcepub fn pii_fields(&self) -> Vec<&'static str>
pub fn pii_fields(&self) -> Vec<&'static str>
Field names considered personally-identifying under the current
context. Returns a stable, deduplicated list. Used by the review
layer to escalate risk on destructive primitives and by the
executor to refuse them outright with
ExecutionError::PolicyViolation.
Conservative by design: the list grows only as each rule is justified. A project needing stricter enforcement can still layer its own checks on top.
Trait Implementations§
Source§impl Clone for ContextConfig
impl Clone for ContextConfig
Source§fn clone(&self) -> ContextConfig
fn clone(&self) -> ContextConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContextConfig
impl Debug for ContextConfig
Source§impl Default for ContextConfig
impl Default for ContextConfig
Source§fn default() -> ContextConfig
fn default() -> ContextConfig
Source§impl<'de> Deserialize<'de> for ContextConfigwhere
ContextConfig: Default,
impl<'de> Deserialize<'de> for ContextConfigwhere
ContextConfig: Default,
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>,
Source§impl PartialEq for ContextConfig
impl PartialEq for ContextConfig
Source§impl Serialize for ContextConfig
impl Serialize for ContextConfig
impl StructuralPartialEq for ContextConfig
Auto Trait Implementations§
impl Freeze for ContextConfig
impl RefUnwindSafe for ContextConfig
impl Send for ContextConfig
impl Sync for ContextConfig
impl Unpin for ContextConfig
impl UnsafeUnpin for ContextConfig
impl UnwindSafe for ContextConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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