pub enum SelectionToolbarPolicy {
Framework,
Native,
}Expand description
The selection-toolbar seam: the request a text field publishes when it
has a selection (SelectionToolbarRequest/SelectionToolbarActions),
and the knobs that decide who draws it.
set_selection_toolbar_policy chooses
SelectionToolbarPolicy::Framework (the default — a field floats its
own pod through the overlay portal) or SelectionToolbarPolicy::Native
(the platform’s own edit menu, e.g. iOS’s UIEditMenuInteraction) — see
that type’s own docs for the two-route split. This is not an
unconditional free choice, though: a platform shell whose system owns the
menu can LOCK it instead, with frust_core::lock_selection_toolbar_policy
— once locked, set_selection_toolbar_policy is refused rather than
obeyed, so an app cannot silently undo a platform requirement it doesn’t
know exists. iOS’s shell locks SelectionToolbarPolicy::Native at
start-up for exactly this reason: a framework-drawn toolbar’s own Paste
button would break the exemption that keeps iOS’s per-app paste-permission
prompt from firing on every paste.
set_selection_toolbar_builder installs the view a Framework-policy
pod floats, replacing whatever the framework’s own baseline (installed
at bootstrap, before the first frame) or an earlier design system already
installed. A design system’s own installer should reach for
frust_core::install_selection_toolbar_builder_if_unset instead — the
cooperative, set-if-unset half of the same pair — so two catalogs linked
into one binary never fight over the slot, and neither ever undoes an
app’s own explicit override.
use frust::{
SelectionToolbarPolicy, lock_selection_toolbar_policy, set_selection_toolbar_policy,
};
// A shell whose platform owns its own system edit menu locks the route,
// so that requirement wins no matter what app code does afterward.
let claimed = lock_selection_toolbar_policy(SelectionToolbarPolicy::Native);
assert!(claimed, "the first claim always takes the lock");
// An app's later override is refused rather than obeyed once locked.
set_selection_toolbar_policy(SelectionToolbarPolicy::Framework);Who draws the selection toolbar.
Variants§
Framework
The framework draws it: the field floats a toolbar pod through the
overlay portal (crate::overlay). The default, and the only route on a
platform with no system edit menu.
Native
The platform draws it: the field publishes the request and nothing else, and the shell presents the host’s own menu.
Trait Implementations§
Source§impl Clone for SelectionToolbarPolicy
impl Clone for SelectionToolbarPolicy
Source§fn clone(&self) -> SelectionToolbarPolicy
fn clone(&self) -> SelectionToolbarPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SelectionToolbarPolicy
Source§impl Debug for SelectionToolbarPolicy
impl Debug for SelectionToolbarPolicy
Source§impl Default for SelectionToolbarPolicy
impl Default for SelectionToolbarPolicy
Source§fn default() -> SelectionToolbarPolicy
fn default() -> SelectionToolbarPolicy
impl Eq for SelectionToolbarPolicy
Source§impl Hash for SelectionToolbarPolicy
impl Hash for SelectionToolbarPolicy
Source§impl PartialEq for SelectionToolbarPolicy
impl PartialEq for SelectionToolbarPolicy
impl StructuralPartialEq for SelectionToolbarPolicy
Auto Trait Implementations§
impl Freeze for SelectionToolbarPolicy
impl RefUnwindSafe for SelectionToolbarPolicy
impl Send for SelectionToolbarPolicy
impl Sync for SelectionToolbarPolicy
impl Unpin for SelectionToolbarPolicy
impl UnsafeUnpin for SelectionToolbarPolicy
impl UnwindSafe for SelectionToolbarPolicy
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<T> Brush for 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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.