CacheItem

Struct CacheItem 

Source
pub struct CacheItem {
    pub object: AccessiblePrimitive,
    pub app: AccessiblePrimitive,
    pub parent: CacheRef,
    pub index: i32,
    pub children_num: i32,
    pub interfaces: InterfaceSet,
    pub role: Role,
    pub states: StateSet,
    pub text: String,
    pub children: Vec<CacheRef>,
    pub cache: Weak<Cache>,
}
Expand description

A struct representing an accessible. To get any information from the cache other than the stored information like role, interfaces, and states, you will need to instantiate an atspi::accessible::AccessibleProxy or other *Proxy type from atspi to query further info.

Fields§

§object: AccessiblePrimitive§app: AccessiblePrimitive§parent: CacheRef§index: i32§children_num: i32§interfaces: InterfaceSet§role: Role§states: StateSet§text: String§children: Vec<CacheRef>§cache: Weak<Cache>

Implementations§

Source§

impl CacheItem

Source

pub fn parent_ref(&mut self) -> OdiliaResult<Arc<RwLock<CacheItem>>>

Return a reference to a parent. This is much cheaper than getting the parent element outright via Self::parent.

§Errors

This method will return a CacheError::NoItem if no item is found within the cache.

Source

pub async fn from_atspi_event<T: Signified>( event: &T, cache: Weak<Cache>, connection: &Connection, ) -> OdiliaResult<Self>

Creates a CacheItem from an atspi::Event type.

§Errors

This can fail under three possible conditions:

  1. We are unable to convert information from the event into an AccessiblePrimitive hashmap key. This should never happen.
  2. We are unable to convert the AccessiblePrimitive to an atspi::accessible::AccessibleProxy.
  3. The accessible_to_cache_item function fails for any reason. This also shouldn’t happen.
Source

pub async fn from_atspi_cache_item( atspi_cache_item: CacheItem, cache: Weak<Cache>, connection: &Connection, ) -> OdiliaResult<Self>

Convert an atspi::cache::CacheItem into a crate::CacheItem. This requires calls to DBus, which is quite expensive. Beware calling this too often.

§Errors

This function can fail under the following conditions:

  1. The atspi::cache::CacheItem can not be turned into a crate::AccessiblePrimitive. This should never happen.
  2. The crate::AccessiblePrimitive can not be turned into a atspi::accessible::AccessibleProxy. This should never happen.
  3. Getting children from the AccessibleProxy fails. This should never happen.

The only time these can fail is if the item is removed on the application side before the conversion to AccessibleProxy.

Source

pub fn get_children(&self) -> OdiliaResult<Vec<Self>>

Get a Vec of children with the same type as Self.

§Errors
  1. Will return an Err variant if self.cache does not reference an active cache. This should never happen, but it is technically possible.
  2. Any children keys’ values are not found in the cache itself.

Trait Implementations§

Source§

impl Accessible for CacheItem

Source§

type Error = OdiliaError

Source§

fn get_application<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetApplication method
Source§

fn parent<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Parent property
Source§

fn get_children<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Self>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetChildren method
Source§

fn child_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<i32, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

ChildCount property
Source§

fn get_index_in_parent<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<i32, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetIndexInParent method; this will give an index between 0 and n, where n is the number of children in the parent.
Source§

fn get_role<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Role, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetRole method
Source§

fn get_interfaces<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<InterfaceSet, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetInterfaces method
Source§

fn get_attributes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, String>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetAttributes method
Source§

fn name<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Name property
Source§

fn locale<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Locale property
Source§

fn description<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Description property
Source§

fn get_relation_set<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(RelationType, Vec<Self>)>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetRelationSet method
Source§

fn get_role_name<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetRoleName method
Source§

fn get_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<StateSet, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetState method
Source§

fn get_child_at_index<'life0, 'async_trait>( &'life0 self, idx: i32, ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetChildAtIndex method
Source§

fn get_localized_role_name<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetLocalizedRoleName method
Source§

fn accessible_id<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<AccessibleId, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

AccessibleId property
Source§

impl Clone for CacheItem

Source§

fn clone(&self) -> CacheItem

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CacheItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CacheItem

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CacheItem

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Text for CacheItem

Source§

type Error = OdiliaError

Source§

fn add_selection<'life0, 'async_trait>( &'life0 self, start_offset: i32, end_offset: i32, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

AddSelection method
Source§

fn get_attribute_run<'life0, 'async_trait>( &'life0 self, offset: i32, include_defaults: bool, ) -> Pin<Box<dyn Future<Output = Result<(HashMap<String, String>, i32, i32), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetAttributeRun method
Source§

fn get_attribute_value<'life0, 'life1, 'async_trait>( &'life0 self, offset: i32, attribute_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

GetAttributeValue method
Source§

fn get_attributes<'life0, 'async_trait>( &'life0 self, offset: i32, ) -> Pin<Box<dyn Future<Output = Result<(HashMap<String, String>, i32, i32), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetAttributes method
Source§

fn get_bounded_ranges<'life0, 'async_trait>( &'life0 self, x: i32, y: i32, width: i32, height: i32, coord_type: CoordType, x_clip_type: ClipType, y_clip_type: ClipType, ) -> Pin<Box<dyn Future<Output = Result<Vec<(i32, i32, String, OwnedValue)>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetBoundedRanges method
Source§

fn get_character_at_offset<'life0, 'async_trait>( &'life0 self, offset: i32, ) -> Pin<Box<dyn Future<Output = Result<i32, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetCharacterAtOffset method
Source§

fn get_character_extents<'life0, 'async_trait>( &'life0 self, offset: i32, coord_type: CoordType, ) -> Pin<Box<dyn Future<Output = Result<(i32, i32, i32, i32), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetCharacterExtents method
Source§

fn get_default_attribute_set<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, String>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetDefaultAttributeSet method
Source§

fn get_default_attributes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, String>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetDefaultAttributes method
Source§

fn get_nselections<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<i32, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetNSelections method
Source§

fn get_offset_at_point<'life0, 'async_trait>( &'life0 self, x: i32, y: i32, coord_type: CoordType, ) -> Pin<Box<dyn Future<Output = Result<i32, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetOffsetAtPoint method
Source§

fn get_range_extents<'life0, 'async_trait>( &'life0 self, start_offset: i32, end_offset: i32, coord_type: CoordType, ) -> Pin<Box<dyn Future<Output = Result<(i32, i32, i32, i32), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetRangeExtents method
Source§

fn get_selection<'life0, 'async_trait>( &'life0 self, selection_num: i32, ) -> Pin<Box<dyn Future<Output = Result<(i32, i32), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetSelection method
Source§

fn get_string_at_offset<'life0, 'async_trait>( &'life0 self, offset: i32, granularity: Granularity, ) -> Pin<Box<dyn Future<Output = Result<(String, i32, i32), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetStringAtOffset method
Source§

fn get_text<'life0, 'async_trait>( &'life0 self, start_offset: i32, end_offset: i32, ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetText method
Source§

fn get_text_after_offset<'life0, 'async_trait>( &'life0 self, offset: i32, type_: u32, ) -> Pin<Box<dyn Future<Output = Result<(String, i32, i32), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetTextAfterOffset method
Source§

fn get_text_at_offset<'life0, 'async_trait>( &'life0 self, offset: i32, type_: u32, ) -> Pin<Box<dyn Future<Output = Result<(String, i32, i32), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetTextAtOffset method
Source§

fn get_text_before_offset<'life0, 'async_trait>( &'life0 self, offset: i32, type_: u32, ) -> Pin<Box<dyn Future<Output = Result<(String, i32, i32), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetTextBeforeOffset method
Source§

fn remove_selection<'life0, 'async_trait>( &'life0 self, selection_num: i32, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

RemoveSelection method
Source§

fn scroll_substring_to<'life0, 'async_trait>( &'life0 self, start_offset: i32, end_offset: i32, type_: u32, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

ScrollSubstringTo method
Source§

fn scroll_substring_to_point<'life0, 'async_trait>( &'life0 self, start_offset: i32, end_offset: i32, type_: u32, x: i32, y: i32, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

ScrollSubstringToPoint method
Source§

fn set_caret_offset<'life0, 'async_trait>( &'life0 self, offset: i32, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

SetCaretOffset method
Source§

fn set_selection<'life0, 'async_trait>( &'life0 self, selection_num: i32, start_offset: i32, end_offset: i32, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

SetSelection method
Source§

fn caret_offset<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<i32, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

CaretOffset property
Source§

fn character_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<i32, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

CharacterCount property

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,