pub struct TargetIdPolicy {
pub dialect: DialectId,
pub max_len: Option<usize>,
pub preserve_source_ids: bool,
pub syntax: IdSyntax,
pub required_prefix: Option<KnownIdPrefix>,
pub allowed_generated_prefixes: Option<Vec<KnownIdPrefix>>,
pub generated_prefix_overrides: Vec<(IdentityRole, KnownIdPrefix)>,
pub reversible_tool_calls: bool,
}Expand description
Target validation used before preserving an upstream id or emitting a generated id. Wire adapters can tighten this for a particular target.
Fields§
§dialect: DialectId§max_len: Option<usize>§preserve_source_ids: bool§syntax: IdSyntax§required_prefix: Option<KnownIdPrefix>§allowed_generated_prefixes: Option<Vec<KnownIdPrefix>>§generated_prefix_overrides: Vec<(IdentityRole, KnownIdPrefix)>§reversible_tool_calls: boolEmit a converted tool call under the reversible alias of
[super::tool_alias] whenever its upstream ID cannot go out as-is, so
a later turn recovers the upstream side from the alias alone. Only a
policy for IDs the client sends back sets this; IDs sent upstream are
never decoded.
Implementations§
Source§impl TargetIdPolicy
impl TargetIdPolicy
pub fn new(dialect: DialectId) -> Self
pub fn with_reversible_tool_calls(self) -> Self
pub fn with_generated_prefixes( self, prefixes: impl IntoIterator<Item = KnownIdPrefix>, ) -> Self
pub fn with_generated_prefix( self, role: IdentityRole, prefix: KnownIdPrefix, ) -> Self
pub fn with_max_len(self, max_len: usize) -> Self
pub fn with_syntax(self, syntax: IdSyntax) -> Self
Sourcepub fn with_required_prefix(self, prefix: KnownIdPrefix) -> Self
pub fn with_required_prefix(self, prefix: KnownIdPrefix) -> Self
Only set this when the target’s actual contract requires the prefix. Conventional generated prefixes alone do not justify this restriction.
pub fn accepts_source(&self, value: &str) -> bool
pub fn accepts_generated(&self, prefix: KnownIdPrefix, value: &str) -> bool
Trait Implementations§
Source§impl Clone for TargetIdPolicy
impl Clone for TargetIdPolicy
Source§impl Debug for TargetIdPolicy
impl Debug for TargetIdPolicy
Source§impl<'de> Deserialize<'de> for TargetIdPolicy
impl<'de> Deserialize<'de> for TargetIdPolicy
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
impl Eq for TargetIdPolicy
Source§impl PartialEq for TargetIdPolicy
impl PartialEq for TargetIdPolicy
Source§impl Serialize for TargetIdPolicy
impl Serialize for TargetIdPolicy
impl StructuralPartialEq for TargetIdPolicy
Auto Trait Implementations§
impl Freeze for TargetIdPolicy
impl RefUnwindSafe for TargetIdPolicy
impl Send for TargetIdPolicy
impl Sync for TargetIdPolicy
impl Unpin for TargetIdPolicy
impl UnsafeUnpin for TargetIdPolicy
impl UnwindSafe for TargetIdPolicy
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