Skip to content

Feature Request: Allow key field to point to functions #21

Description

@Swoorup

Description

Currently, the key field in the venndb library is limited to pointing to struct fields. We could an enhancement to allow the key field to point to functions inside the struct, providing more flexibility in key definitions and usage.

Example

#[derive(VennDB)]
#[venndb(key = "get_dynamic_key")]
struct ExampleStruct {
    #[venndb(key)]
    id: u32,
    name: String,
}

impl ExampleStruct {
    fn get_dynamic_key(&self) -> u32 {
    }
}

Benefits

Increased flexibility in defining keys for the venndb library.
Support for dynamic key generation based on custom logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions