Skip to content

Commit

Permalink
Fix lookup requiring known sizes at compile-time
Browse files Browse the repository at this point in the history
  • Loading branch information
bkolobara committed Aug 9, 2023
1 parent 3c5d361 commit 0830359
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lunatic"
version = "0.14.0"
version = "0.14.1"
edition = "2021"
authors = ["Bernard Kolobara <[email protected]>"]
description = "Helper library for building Rust applications that run on lunatic."
Expand Down
2 changes: 1 addition & 1 deletion src/ap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ where

/// Returns a process registered under `name` if it exists and the signature
/// matches.
pub fn lookup<N: ProcessName>(name: &N) -> Option<Self> {
pub fn lookup<N: ProcessName + ?Sized>(name: &N) -> Option<Self> {
let name = process_name::<T, T::Serializer>(ProcessType::ProcessRef, name.process_name());
let mut id = 0;
let mut node_id = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/function/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ impl<M, S> Process<M, S> {
}

/// Look up a process.
pub fn lookup<N: ProcessName>(name: &N) -> Option<Self> {
pub fn lookup<N: ProcessName + ?Sized>(name: &N) -> Option<Self> {
let name = process_name::<M, S>(ProcessType::Process, name.process_name());
let mut id = 0;
let mut node_id = 0;
Expand Down
7 changes: 4 additions & 3 deletions src/process_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/// It is implemented for common string types such as `&str` and `String`,
/// but can be implemented on a custom type to create a process name type.
///
/// It is best used with the [ProcessName](lunatic_macros::ProcessName) derive macro
/// to generate a unique name.
/// It is best used with the [ProcessName](lunatic_macros::ProcessName) derive
/// macro to generate a unique name.
///
/// # Example
///
Expand All @@ -28,7 +28,8 @@
/// }
/// ```
///
/// For more information, see the [derive macro](lunatic_macros::ProcessName) docs.
/// For more information, see the [derive macro](lunatic_macros::ProcessName)
/// docs.
pub trait ProcessName {
fn process_name(&self) -> &str;
}
Expand Down

0 comments on commit 0830359

Please sign in to comment.