pub struct ActionSpec {Show 16 fields
pub name: ActionName,
pub route: RouteSpec,
pub params: Vec<ParamSpec>,
pub calls: Vec<ActionRef>,
pub display_name: String,
pub description: String,
pub permissions: Vec<String>,
pub permission_mode: PermissionMode,
pub is_public: bool,
pub request_media_type: ActionMediaType,
pub multipart: Option<MultipartSpec>,
pub response_kind: ActionResponseKind,
pub success_status: u16,
pub tags: Vec<String>,
pub input_schema: Value,
pub output_schema: Value,
/* private fields */
}Expand description
Action 的定义期契约。
Fields§
§name: ActionNameAction 局部名称。
route: RouteSpec唯一传输路由。
params: Vec<ParamSpec>强类型参数定义。
calls: Vec<ActionRef>内部调用依赖。
display_name: String用户可见名称。
description: String业务说明。
permissions: Vec<String>Action 所需权限。
permission_mode: PermissionMode权限集合的匹配方式。
is_public: bool是否允许匿名访问。
request_media_type: ActionMediaType请求媒体类型。
multipart: Option<MultipartSpec>multipart 资源与类型限制;仅 multipart Action 可用。
response_kind: ActionResponseKind成功响应的静态类别,供调用方选择安全的展示方式。
success_status: u16成功响应状态码。
OpenAPI/后台元数据标签。
input_schema: ValueHandler Input 的构建期 JSON Schema。
output_schema: ValueHandler Output 的构建期 JSON Schema。
Implementations§
Source§impl ActionSpec
impl ActionSpec
Sourcepub fn new(name: ActionName, route: RouteSpec) -> Self
pub fn new(name: ActionName, route: RouteSpec) -> Self
创建最小 Action 定义。
Sourcepub fn display_name(self, display_name: impl Into<String>) -> Self
pub fn display_name(self, display_name: impl Into<String>) -> Self
设置用户可见名称。
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
设置业务说明。
Sourcepub fn permissions<I, S>(self, permissions: I, mode: PermissionMode) -> Self
pub fn permissions<I, S>(self, permissions: I, mode: PermissionMode) -> Self
设置所需权限及匹配方式。
Sourcepub fn multipart(self, multipart: MultipartSpec) -> Self
pub fn multipart(self, multipart: MultipartSpec) -> Self
声明 Action 接受受限的 multipart/form-data 请求。
Sourcepub fn response_kind(self, response_kind: ActionResponseKind) -> Self
pub fn response_kind(self, response_kind: ActionResponseKind) -> Self
声明成功响应的静态类别。
Sourcepub fn success_status(self, success_status: u16) -> Self
pub fn success_status(self, success_status: u16) -> Self
设置成功响应 HTTP 状态码。
Trait Implementations§
Source§impl Clone for ActionSpec
impl Clone for ActionSpec
Source§impl Debug for ActionSpec
impl Debug for ActionSpec
impl Eq for ActionSpec
Source§impl From<&ActionSpec> for ActionDemoSchema
impl From<&ActionSpec> for ActionDemoSchema
Source§fn from(action: &ActionSpec) -> Self
fn from(action: &ActionSpec) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ActionSpec
impl PartialEq for ActionSpec
impl StructuralPartialEq for ActionSpec
Auto Trait Implementations§
impl Forget for ActionSpec
impl Freeze for ActionSpec
impl Move for ActionSpec
impl RefUnwindSafe for ActionSpec
impl Send for ActionSpec
impl Sync for ActionSpec
impl Unpin for ActionSpec
impl UnsafeUnpin for ActionSpec
impl UnwindSafe for ActionSpec
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<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
Compare self to
key and return true if they are equal.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 more