pub struct TaskId { /* private fields */ }Expand description
Uniquely identifies a task definition (language + module path + function name).
Mirrors pynenc’s TaskId which is computed as module.function_name.
The optional language field enables cross-language task routing:
when empty, the task is local (same language); when set (e.g. “rust”,
“python”), it identifies a foreign task for per-language queue routing.
§Format
The canonical string representation is:
- Local tasks:
module.name - Foreign tasks:
language::module.name
The name field must not contain dots to ensure lossless round-tripping
through Display/FromStr.
§Representation
Internally, all three components are packed into a single Arc<str>
allocation with byte offsets for O(1) field access. Cloning a TaskId
is a single atomic increment with zero heap allocation.
Implementations§
Source§impl TaskId
impl TaskId
Sourcepub fn try_new(
module: impl Into<String>,
name: impl Into<String>,
) -> Result<TaskId, ParseTaskIdError>
pub fn try_new( module: impl Into<String>, name: impl Into<String>, ) -> Result<TaskId, ParseTaskIdError>
Fallible constructor for user-supplied input at API boundaries.
Returns Err if name contains a dot.
Sourcepub fn foreign(
language: impl Into<String>,
module: impl Into<String>,
name: impl Into<String>,
) -> TaskId
pub fn foreign( language: impl Into<String>, module: impl Into<String>, name: impl Into<String>, ) -> TaskId
Create a foreign (cross-language) task ID.
§Panics
Panics if language is empty — use TaskId::new for local tasks.
Use try_foreign for user-supplied input at API boundaries.
Sourcepub fn try_foreign(
language: impl Into<String>,
module: impl Into<String>,
name: impl Into<String>,
) -> Result<TaskId, ParseTaskIdError>
pub fn try_foreign( language: impl Into<String>, module: impl Into<String>, name: impl Into<String>, ) -> Result<TaskId, ParseTaskIdError>
Fallible constructor for foreign task IDs from user-supplied input.
Returns Err if language is empty or name contains a dot.
Sourcepub fn is_foreign(&self) -> bool
pub fn is_foreign(&self) -> bool
Whether this references a task in a different language.
Sourcepub fn config_key(&self) -> String
pub fn config_key(&self) -> String
Config file key for this task (dots replaced with underscores).
Mirrors pynenc’s TaskId.config_key used for TOML/YAML lookups.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TaskId
impl<'de> Deserialize<'de> for TaskId
Source§fn deserialize<D>(
deserializer: D,
) -> Result<TaskId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<TaskId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl FromStr for TaskId
impl FromStr for TaskId
Source§fn from_str(s: &str) -> Result<TaskId, <TaskId as FromStr>::Err>
fn from_str(s: &str) -> Result<TaskId, <TaskId as FromStr>::Err>
Parse a TaskId from its canonical string representation.
Accepted formats:
module.name— local tasklanguage::module.name— foreign task
Returns an error if the string is empty, contains no . separator
(in the module.name portion), or has empty module or name components.
Source§type Err = ParseTaskIdError
type Err = ParseTaskIdError
Source§impl Serialize for TaskId
impl Serialize for TaskId
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,
impl Eq for TaskId
impl StructuralPartialEq for TaskId
Auto Trait Implementations§
impl Freeze for TaskId
impl RefUnwindSafe for TaskId
impl Send for TaskId
impl Sync for TaskId
impl Unpin for TaskId
impl UnsafeUnpin for TaskId
impl UnwindSafe for TaskId
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,
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.