pub struct FunctionDefinition {
pub name: String,
pub trigger: String,
pub runtime: RuntimeType,
pub timeout_ms: Option<u64>,
}Expand description
Definition of a serverless function for deployment and execution.
Fields§
§name: StringUnique name for this function.
trigger: StringTrigger type and configuration (e.g., “after:mutation:createUser”, “cron:0 * * * *”, “http:GET:/users/:id”).
runtime: RuntimeTypeWhich runtime executes this function.
timeout_ms: Option<u64>Optional timeout in milliseconds (overrides defaults).
- For
before:mutationtriggers: defaults to 500ms - For other triggers: defaults to 5s
Implementations§
Source§impl FunctionDefinition
impl FunctionDefinition
Sourcepub fn new(name: &str, trigger: &str, runtime: RuntimeType) -> Self
pub fn new(name: &str, trigger: &str, runtime: RuntimeType) -> Self
Create a new function definition.
Sourcepub const fn with_timeout(self, timeout_ms: u64) -> Self
pub const fn with_timeout(self, timeout_ms: u64) -> Self
Set a custom timeout for this function.
Sourcepub fn effective_timeout(&self) -> Duration
pub fn effective_timeout(&self) -> Duration
Get the effective timeout for this function.
Sourcepub fn is_before_mutation(&self) -> bool
pub fn is_before_mutation(&self) -> bool
Check if this function is a before:mutation trigger.
Sourcepub fn is_after_mutation(&self) -> bool
pub fn is_after_mutation(&self) -> bool
Check if this function is an after:mutation trigger.
Sourcepub fn is_after_storage(&self) -> bool
pub fn is_after_storage(&self) -> bool
Check if this function is an after:storage trigger.
Trait Implementations§
Source§impl Clone for FunctionDefinition
impl Clone for FunctionDefinition
Source§fn clone(&self) -> FunctionDefinition
fn clone(&self) -> FunctionDefinition
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 FunctionDefinition
impl Debug for FunctionDefinition
Source§impl<'de> Deserialize<'de> for FunctionDefinition
impl<'de> Deserialize<'de> for FunctionDefinition
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
Auto Trait Implementations§
impl Freeze for FunctionDefinition
impl RefUnwindSafe for FunctionDefinition
impl Send for FunctionDefinition
impl Sync for FunctionDefinition
impl Unpin for FunctionDefinition
impl UnsafeUnpin for FunctionDefinition
impl UnwindSafe for FunctionDefinition
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