pub struct GrantedUse {
pub id: String,
pub text: String,
pub modes: Vec<Mode>,
}Expand description
Something the home lets every agent on it do beyond its definition, because the host
gives each agent it runs the tools for it (spec 3.3 §5.7, S-I12, S-I13): shown under
“Here is what Finance can do” as “On this home it can also:”. Hosts register each with
SurfaceEngineBuilder::grant.
§Example
use adk_surface::GrantedUse;
let draws = GrantedUse::new("genui", "Show forms and tables in your threads — sending asks you first");
assert_eq!(draws.id, "genui");Fields§
§id: StringThe feature that grants it, such as genui: one line per id. Never shown.
text: StringWhat it can do, in plain words: “Ask to change things on your screens — always asks you first”.
modes: Vec<Mode>The modes in which an agent can use it; empty for every mode. A surface lists it for an agent only in one of them, so what an agent’s settings say it can do is true (S-I13).
Implementations§
Source§impl GrantedUse
impl GrantedUse
Sourcepub fn new(id: impl Into<String>, text: impl Into<String>) -> Self
pub fn new(id: impl Into<String>, text: impl Into<String>) -> Self
The use text, granted by the feature id, in every mode.
Sourcepub fn only_in(self, modes: impl IntoIterator<Item = Mode>) -> Self
pub fn only_in(self, modes: impl IntoIterator<Item = Mode>) -> Self
Granted only to an agent in one of modes: one that asks, for a use that asks the
person, as the modes that only look or suggest refuse every such call (spec 3.3 §5.7).
§Example
use adk_surface::{GrantedUse, Mode};
let asks = GrantedUse::new("verb-ui", "Ask to change things on your screens")
.only_in([Mode::AskFirst, Mode::GoAhead]);
assert!(asks.holds_in(Mode::GoAhead));
assert!(!asks.holds_in(Mode::Suggest));Trait Implementations§
Source§impl Clone for GrantedUse
impl Clone for GrantedUse
Source§impl Debug for GrantedUse
impl Debug for GrantedUse
Source§impl<'de> Deserialize<'de> for GrantedUse
impl<'de> Deserialize<'de> for GrantedUse
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>,
impl Eq for GrantedUse
Source§impl JsonSchema for GrantedUse
impl JsonSchema for GrantedUse
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 GrantedUse
impl PartialEq for GrantedUse
Source§impl Serialize for GrantedUse
impl Serialize for GrantedUse
impl StructuralPartialEq for GrantedUse
Auto Trait Implementations§
impl Forget for GrantedUse
impl Freeze for GrantedUse
impl Move for GrantedUse
impl RefUnwindSafe for GrantedUse
impl Send for GrantedUsewhere
RawVecInner: Send,
impl Sync for GrantedUsewhere
RawVecInner: Sync,
impl Unpin for GrantedUse
impl UnsafeUnpin for GrantedUsewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Mode>: UnsafeUnpin,
impl UnwindSafe for GrantedUsewhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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<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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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