pub struct CredentialFieldDecl {
pub field_path: Vec<String>,
pub variant_tag: Option<String>,
pub metadata: CredentialMetadata,
}Expand description
One entry per credential-bearing field in a method’s return type.
Pinned by AUTHZ-CRED-S01-output.md §4 and AUTHZ-CRED-CORE-3 §“Required
behavior”. Projected onto MethodSchema.credentials at schema-build time
from the CredentialFieldMarker registry the #[derive(Credentials)] macro
emits per credential-bearing type (AUTHZ-CRED-MACRO-1).
§Field path semantics (Tier B Q-IR-1)
field_path is the JSON-object path to the credential field within the
method’s return type. v1 always uses object-field paths (one segment per
field name walked); array indices and JSON Pointer syntax are intentionally
excluded because credentials always live on object fields in v1, never
inside array elements.
Example: for a return type
struct LoginResult { session: Credential<String> }, the field path is
["session"]. For a nested case
struct LoginResult { auth: AuthBundle } where AuthBundle itself
declares a #[plexus::credential(..)] field token: Credential<String>,
the field path is ["auth", "token"].
§Variant tagging
variant_tag is Some(tag) when the method’s return type is an enum and
the credential lives on a single variant. The tag matches the variant
identifier as the macro registry records it (e.g. "Issued" for the
LoginEvent::Issued variant). None means the return type is a struct,
or the credential appears on every variant of the enum (rare).
§Wire back-compat
Added in AUTHZ-CRED-CORE-3. Pre-existing readers tolerate credentials: [] (the default on MethodSchema when no credentials are declared) and
pre-existing IRs that omit the field altogether decode cleanly via
#[serde(default)] on the field site.
Fields§
§field_path: Vec<String>JSON-object path to the credential field within the method’s return type. One segment per field-name walk; pinned to object paths (no array indices, no JSON Pointer) per Tier B Q-IR-1.
variant_tag: Option<String>Variant tag when the return type is an enum and the credential lives
on a single variant. None for structs.
metadata: CredentialMetadataThe credential’s metadata (kind, attach site, scheme, scopes, expiry, refresh/revoke hints, issuer, sensitivity). Carried verbatim so consumers embed identical storage-and-attach logic to the runtime.
Implementations§
Source§impl CredentialFieldDecl
impl CredentialFieldDecl
Sourcepub fn from_marker(
marker: &CredentialFieldMarker,
path_prefix: &[&str],
issuer: CredentialIssuer,
) -> Self
pub fn from_marker( marker: &CredentialFieldMarker, path_prefix: &[&str], issuer: CredentialIssuer, ) -> Self
Construct a CredentialFieldDecl by composing a CredentialFieldMarker
from the macro-emitted registry with the runtime-supplied pieces
(expires_at known only at mint time; issuer known at schema-build
time from the originating method’s (Origin, MethodPath)).
path_prefix is the field-path walk to the marker’s parent type — for
a flat struct it is empty; for a nested case where this marker lives
inside a field of the method’s return type the prefix is the path to
that wrapping field. The marker’s own field and variant are
appended.
Trait Implementations§
Source§impl Clone for CredentialFieldDecl
impl Clone for CredentialFieldDecl
Source§fn clone(&self) -> CredentialFieldDecl
fn clone(&self) -> CredentialFieldDecl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CredentialFieldDecl
impl Debug for CredentialFieldDecl
Source§impl<'de> Deserialize<'de> for CredentialFieldDecl
impl<'de> Deserialize<'de> for CredentialFieldDecl
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 JsonSchema for CredentialFieldDecl
impl JsonSchema for CredentialFieldDecl
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for CredentialFieldDecl
impl PartialEq for CredentialFieldDecl
Source§fn eq(&self, other: &CredentialFieldDecl) -> bool
fn eq(&self, other: &CredentialFieldDecl) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for CredentialFieldDecl
impl Serialize for CredentialFieldDecl
impl Eq for CredentialFieldDecl
impl StructuralPartialEq for CredentialFieldDecl
Auto Trait Implementations§
impl Freeze for CredentialFieldDecl
impl RefUnwindSafe for CredentialFieldDecl
impl Send for CredentialFieldDecl
impl Sync for CredentialFieldDecl
impl Unpin for CredentialFieldDecl
impl UnsafeUnpin for CredentialFieldDecl
impl UnwindSafe for CredentialFieldDecl
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.