pub struct PromptVariable {
pub name: String,
pub description: Option<String>,
pub var_type: VariableType,
pub required: bool,
pub default: Option<String>,
pub pattern: Option<String>,
pub enum_values: Option<Vec<String>>,
}Expand description
Prompt 变量定义
Fields§
§name: String变量名称
description: Option<String>变量描述
var_type: VariableType变量类型
required: bool是否必需
default: Option<String>默认值
pattern: Option<String>验证正则表达式
enum_values: Option<Vec<String>>枚举选项
Implementations§
Source§impl PromptVariable
impl PromptVariable
Sourcepub fn new(name: impl Into<String>) -> PromptVariable
pub fn new(name: impl Into<String>) -> PromptVariable
创建新的变量定义
Sourcepub fn with_description(self, desc: impl Into<String>) -> PromptVariable
pub fn with_description(self, desc: impl Into<String>) -> PromptVariable
设置描述
Sourcepub fn with_type(self, var_type: VariableType) -> PromptVariable
pub fn with_type(self, var_type: VariableType) -> PromptVariable
设置类型
Sourcepub fn required(self, required: bool) -> PromptVariable
pub fn required(self, required: bool) -> PromptVariable
设置是否必需
Sourcepub fn with_default(self, default: impl Into<String>) -> PromptVariable
pub fn with_default(self, default: impl Into<String>) -> PromptVariable
设置默认值
Sourcepub fn with_pattern(self, pattern: impl Into<String>) -> PromptVariable
pub fn with_pattern(self, pattern: impl Into<String>) -> PromptVariable
设置验证正则
Sourcepub fn with_enum(self, values: Vec<String>) -> PromptVariable
pub fn with_enum(self, values: Vec<String>) -> PromptVariable
设置枚举值
Trait Implementations§
Source§impl Clone for PromptVariable
impl Clone for PromptVariable
Source§fn clone(&self) -> PromptVariable
fn clone(&self) -> PromptVariable
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PromptVariable
impl Debug for PromptVariable
Source§impl<'de> Deserialize<'de> for PromptVariable
impl<'de> Deserialize<'de> for PromptVariable
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PromptVariable, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PromptVariable, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for PromptVariable
impl Serialize for PromptVariable
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for PromptVariable
impl RefUnwindSafe for PromptVariable
impl Send for PromptVariable
impl Sync for PromptVariable
impl Unpin for PromptVariable
impl UnsafeUnpin for PromptVariable
impl UnwindSafe for PromptVariable
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
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>
Converts
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>
Converts
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 moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage