pub struct ShortcutFactory(pub fn() -> ShortcutBlock);Expand description
A registered shortcut factory: a plain function pointer that produces a ShortcutBlock.
§Why a function pointer and not Box<dyn Trait>?
inventory requires collected types to be 'static. A fn() -> ShortcutBlock is
trivially 'static and requires no heap allocation at registration time, making it
ideal for link-time auto-registration.
§How to register a new provider (e.g. Jira)
In gitlab-tracker-jira/src/shortcuts.rs, add:
fn jira_shortcuts() -> ShortcutBlock { /* … */ }
inventory::submit!(ShortcutFactory(jira_shortcuts));That’s it — no change to main.rs or any other existing file.
Tuple Fields§
§0: fn() -> ShortcutBlockTrait Implementations§
impl Collect for ShortcutFactory
Auto Trait Implementations§
impl Freeze for ShortcutFactory
impl RefUnwindSafe for ShortcutFactory
impl Send for ShortcutFactory
impl Sync for ShortcutFactory
impl Unpin for ShortcutFactory
impl UnsafeUnpin for ShortcutFactory
impl UnwindSafe for ShortcutFactory
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