Struct SharedSelection
pub struct SharedSelection {
pub resource: Option<ActionResource>,
pub anchor: SelectionAnchor,
pub resource_kind: Option<String>,
pub bounds: Option<Rect>,
}Expand description
A person’s selection in one window: the resource it is in, when known, and where in it.
Fields§
§resource: Option<ActionResource>The published resource the selection is in. The app runner fills it from its publication when the widget does not name one.
anchor: SelectionAnchorThe place, the application’s own interaction anchor and the excerpt.
resource_kind: Option<String>The kind of the resource the place’s item belongs to, which picks the
published resource when Self::resource is absent. Local only.
bounds: Option<Rect>Where the selection is drawn, in the window’s logical coordinates: the selected text’s lines, else the text block holding it. The shell keeps its agent composer clear of it. Local only: geometry is no part of what an agent is told.
Implementations§
pub fn of_text(text: &str) -> SharedSelection
pub fn of_text(text: &str) -> SharedSelection
Selected text, with no place.
pub fn of_items<I, L>(
items: impl IntoIterator<Item = (I, L)>,
) -> SharedSelection
pub fn of_items<I, L>( items: impl IntoIterator<Item = (I, L)>, ) -> SharedSelection
Several whole items selected, each (id, label) in the order shown
(files in a folder, rows of a list): every item named as a place and
the excerpt listing their labels.
pub fn at(self, place: SelectionPlace) -> SharedSelection
pub fn at(self, place: SelectionPlace) -> SharedSelection
This selection at place.
pub fn in_resource(self, resource: ActionResource) -> SharedSelection
pub fn in_resource(self, resource: ActionResource) -> SharedSelection
This selection in resource.
pub fn in_kind(self, kind: impl Into<String>) -> SharedSelection
pub fn in_kind(self, kind: impl Into<String>) -> SharedSelection
This selection in a resource of kind, resolved against the app’s
publication.
pub fn within(self, bounds: Rect) -> SharedSelection
pub fn within(self, bounds: Rect) -> SharedSelection
This selection drawn within bounds, in window coordinates.
pub fn protocol_bounds(&self) -> Option<[f64; 4]>
pub fn protocol_bounds(&self) -> Option<[f64; 4]>
Where the selection is drawn, as the shell protocol carries it:
None when unknown or degenerate.
pub fn to_attached(
&self,
app: Option<&str>,
record: Option<&str>,
) -> Option<Attached>
pub fn to_attached( &self, app: Option<&str>, record: Option<&str>, ) -> Option<Attached>
This selection as a thing to send: the record it is in, with the item or the run of characters it names, or — when the app publishes no resource to go with the words — the words quoted.
app names the app that publishes that record and record its
workspace record (None: the app’s own); app is None when nobody
says which app’s record it is, and what travels then is the words
alone: a reference to no app addresses nothing.
A selection of several items travels as those items; a range inside
one travels as that item and its character span, in the app’s own
unit, so the app can address the run again when the chip is opened.
None when the person selected nothing worth sending.
pub fn resolve_resource(&mut self, published: &[ResourceSpec])
pub fn resolve_resource(&mut self, published: &[ResourceSpec])
Name the published resource the selection is in when the widget did
not: the resource of Self::resource_kind, else the first one.
Trait Implementations§
§fn clone(&self) -> SharedSelection
fn clone(&self) -> SharedSelection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§fn default() -> SharedSelection
fn default() -> SharedSelection
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SharedSelection, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SharedSelection, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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