pub struct DrawingToolRegistry { /* private fields */ }Expand description
Per-manager catalogue. Register stable host-owned string ids before loading drawings. Unknown custom ids stay in storage but are not rendered or hit until registered. Clone the catalogue into a host picker to share implementations and availability.
Implementations§
Source§impl DrawingToolRegistry
impl DrawingToolRegistry
Sourcepub fn register(
&mut self,
id: impl Into<String>,
tool: RegisteredDrawingTool,
) -> Result<(), &'static str>
pub fn register( &mut self, id: impl Into<String>, tool: RegisteredDrawingTool, ) -> Result<(), &'static str>
Registers a tool. Empty ids, zero anchors and duplicate ids leave the catalogue intact.
Sourcepub fn get(&self, id: &str) -> Option<&RegisteredDrawingTool>
pub fn get(&self, id: &str) -> Option<&RegisteredDrawingTool>
Looks up a custom tool by its saved id.
Sourcepub fn custom_tools(
&self,
) -> impl Iterator<Item = (&str, &RegisteredDrawingTool)>
pub fn custom_tools( &self, ) -> impl Iterator<Item = (&str, &RegisteredDrawingTool)>
Custom tool ids and metadata in stable id order for host pickers.
Sourcepub fn set_availability(
&mut self,
tool: DrawingToolType,
availability: ToolAvailability,
)
pub fn set_availability( &mut self, tool: DrawingToolType, availability: ToolAvailability, )
Hides or disables a built-in tool. Hidden tools may still be created by the host when enabled; disabling rejects new creation through the manager and chart APIs. Duplicates, pastes and copies of its drawings are left out; restoring and syncing them is not affected.
Sourcepub fn availability(&self, tool: DrawingToolType) -> ToolAvailability
pub fn availability(&self, tool: DrawingToolType) -> ToolAvailability
Availability of a built-in tool; all tools are visible and enabled by default.
Sourcepub fn builtin_tools(
&self,
) -> impl Iterator<Item = (DrawingToolType, ToolAvailability)> + '_
pub fn builtin_tools( &self, ) -> impl Iterator<Item = (DrawingToolType, ToolAvailability)> + '_
Built-in picker entries, excluding hidden tools and including disabled entries.
Trait Implementations§
Source§impl Clone for DrawingToolRegistry
impl Clone for DrawingToolRegistry
Source§fn clone(&self) -> DrawingToolRegistry
fn clone(&self) -> DrawingToolRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for DrawingToolRegistry
impl Default for DrawingToolRegistry
Source§fn default() -> DrawingToolRegistry
fn default() -> DrawingToolRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for DrawingToolRegistry
impl !UnwindSafe for DrawingToolRegistry
impl Freeze for DrawingToolRegistry
impl Send for DrawingToolRegistry
impl Sync for DrawingToolRegistry
impl Unpin for DrawingToolRegistry
impl UnsafeUnpin for DrawingToolRegistry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more