diff --git a/udf-uuid/src/convert.rs b/udf-uuid/src/convert.rs index f0b85c8..4a63e44 100644 --- a/udf-uuid/src/convert.rs +++ b/udf-uuid/src/convert.rs @@ -10,7 +10,7 @@ use crate::{HYPHENATED_UUID_LEN, HYPHENATED_UUID_LEN_U64, UUID_BYTES_LEN, UUID_B #[derive(Debug, Default)] struct UuidToBin(UuidBytes); -#[register] +#[register(name = "uuid_to_bin")] impl BasicUdf for UuidToBin { type Returns<'a> = Option<&'a [u8]>; @@ -66,7 +66,7 @@ impl BasicUdf for UuidToBin { #[derive(Debug)] struct UuidFromBin([u8; HYPHENATED_UUID_LEN]); -#[register] +#[register(name = "uuid_from_bin", alias = "bin_to_uuid")] impl BasicUdf for UuidFromBin { type Returns<'a> = Option<&'a str>; @@ -122,28 +122,6 @@ impl BasicUdf for UuidFromBin { } } -/// Alias to `uuid_from_bin` -#[derive(Debug)] -struct BinToUuid(UuidFromBin); - -#[register] -impl BasicUdf for BinToUuid { - type Returns<'a> = Option<&'a str>; - - fn init(cfg: &UdfCfg, args: &ArgList) -> Result { - Ok(Self(UuidFromBin::init(cfg, args)?)) - } - - fn process<'a>( - &'a mut self, - cfg: &UdfCfg, - args: &ArgList, - error: Option, - ) -> Result, ProcessError> { - UuidFromBin::process(&mut self.0, cfg, args, error) - } -} - // Positions of components within a v1 UUID const NODE: usize = 8; const LOW_TIME: usize = 0; diff --git a/udf-uuid/src/generate.rs b/udf-uuid/src/generate.rs index 98ba8e5..137565f 100644 --- a/udf-uuid/src/generate.rs +++ b/udf-uuid/src/generate.rs @@ -11,12 +11,12 @@ use crate::{validate_arg_count, HYPHENATED_UUID_LEN, HYPHENATED_UUID_LEN_U64}; #[derive(Debug)] struct UuidGenerateV1 { /// We save the mac address during the `init` call because that won't change. - /// Saves a few ms, maybe + /// Saves a few us, maybe mac: [u8; 6], res: [u8; HYPHENATED_UUID_LEN], } -#[register] +#[register(name = "uuid_generate_v1")] impl BasicUdf for UuidGenerateV1 { type Returns<'a> = &'a [u8]; @@ -51,10 +51,10 @@ impl BasicUdf for UuidGenerateV1 { /// V1 UUID with randomized MAC address #[derive(Debug)] -struct UuidGenerateV1mc([u8; HYPHENATED_UUID_LEN]); +struct UuidGenerateV1RandomMac([u8; HYPHENATED_UUID_LEN]); -#[register] -impl BasicUdf for UuidGenerateV1mc { +#[register(name = "uuid_generate_v1mc")] +impl BasicUdf for UuidGenerateV1RandomMac { type Returns<'a> = &'a [u8]; fn init(cfg: &UdfCfg, args: &ArgList) -> Result { @@ -84,7 +84,7 @@ impl BasicUdf for UuidGenerateV1mc { #[derive(Debug)] struct UuidGenerateV4([u8; HYPHENATED_UUID_LEN]); -#[register] +#[register(name = "uuid_generate_v4")] impl BasicUdf for UuidGenerateV4 { type Returns<'a> = &'a [u8]; @@ -111,7 +111,7 @@ impl BasicUdf for UuidGenerateV4 { #[derive(Debug)] struct UuidGenerateV6([u8; HYPHENATED_UUID_LEN]); -#[register] +#[register(name = "uuid_generate_v6")] impl BasicUdf for UuidGenerateV6 { type Returns<'a> = &'a [u8]; @@ -160,7 +160,7 @@ impl BasicUdf for UuidGenerateV6 { #[derive(Debug)] struct UuidGenerateV7([u8; HYPHENATED_UUID_LEN]); -#[register] +#[register(name = "uuid_generate_v7")] impl BasicUdf for UuidGenerateV7 { type Returns<'a> = &'a [u8]; diff --git a/udf-uuid/src/valid.rs b/udf-uuid/src/valid.rs index c7ab4a9..3e7ce14 100644 --- a/udf-uuid/src/valid.rs +++ b/udf-uuid/src/valid.rs @@ -7,7 +7,7 @@ use crate::validate_arg_count; #[derive(Debug, PartialEq)] struct UuidIsValid; -#[register] +#[register(name = "uuid_is_valid")] impl BasicUdf for UuidIsValid { type Returns<'a> = i64;