pub struct OperatorRef(/* private fields */);Expand description
Logical Operator role handle — the one type behind the three names the
same concept used to carry: a Blueprint’s AgentDef.spec.operator_ref,
a BindRequest::binding_target, and the roles a
POST /v1/operators login mints.
§Why a newtype and not String
Those three sites name one thing: “which Operator is meant”, written by
the Blueprint author and claimed at login. Spelling it String
everywhere let it be swapped at a call site with the several other
strings that travel alongside it — an agent name, a session id, a
launch variant — none of which the compiler could tell apart.
Deliberately not built from the id_newtype! macro: that shape
mints <PREFIX>-<hex> values and validates the prefix, which fits a
server-minted id like BindingDigest’s siblings. An OperatorRef is
authored, not minted (main-ai, phase_a_op), so it carries no prefix
and no generated form.
§The only rule is “not empty”
No naming convention is imposed — every name an existing Blueprint
already uses stays valid. An empty ref is rejected because it can only
be a mistake: nothing can hold the role "", so it names no Operator
and would fail later, further from the author who wrote it.
The wire form is unchanged: a plain string in both directions
(#[serde(try_from = "String")] over a newtype, so serialization is the
inner string verbatim and deserialization runs the emptiness check at
the boundary).
Implementations§
Source§impl OperatorRef
impl OperatorRef
Trait Implementations§
Source§impl AsRef<str> for OperatorRef
impl AsRef<str> for OperatorRef
Source§impl Borrow<str> for OperatorRef
Lets a HashMap<OperatorRef, _> be probed with a plain &str, so a
lookup does not have to allocate (or fallibly construct) a ref first.
impl Borrow<str> for OperatorRef
Lets a HashMap<OperatorRef, _> be probed with a plain &str, so a
lookup does not have to allocate (or fallibly construct) a ref first.
Sound because the derived Hash / Eq on this newtype are exactly the
inner String’s, which are in turn str’s — the Borrow contract’s
requirement that borrowed and owned forms hash and compare identically.
Source§impl Clone for OperatorRef
impl Clone for OperatorRef
Source§fn clone(&self) -> OperatorRef
fn clone(&self) -> OperatorRef
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 OperatorRef
impl Debug for OperatorRef
Source§impl<'de> Deserialize<'de> for OperatorRef
impl<'de> Deserialize<'de> for OperatorRef
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 Display for OperatorRef
impl Display for OperatorRef
impl Eq for OperatorRef
Source§impl From<OperatorRef> for String
impl From<OperatorRef> for String
Source§fn from(operator_ref: OperatorRef) -> String
fn from(operator_ref: OperatorRef) -> String
Source§impl FromStr for OperatorRef
impl FromStr for OperatorRef
Source§impl Hash for OperatorRef
impl Hash for OperatorRef
Source§impl Ord for OperatorRef
impl Ord for OperatorRef
Source§fn cmp(&self, other: &OperatorRef) -> Ordering
fn cmp(&self, other: &OperatorRef) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for OperatorRef
impl PartialEq for OperatorRef
Source§impl PartialOrd for OperatorRef
impl PartialOrd for OperatorRef
Source§impl Serialize for OperatorRef
impl Serialize for OperatorRef
impl StructuralPartialEq for OperatorRef
Source§impl TryFrom<String> for OperatorRef
impl TryFrom<String> for OperatorRef
Source§type Error = EmptyOperatorRef
type Error = EmptyOperatorRef
Auto Trait Implementations§
impl Freeze for OperatorRef
impl RefUnwindSafe for OperatorRef
impl Send for OperatorRef
impl Sync for OperatorRef
impl Unpin for OperatorRef
impl UnsafeUnpin for OperatorRef
impl UnwindSafe for OperatorRef
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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