Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lazy, cheaply guarded proxy-conversions. #202

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

luukvanderduim
Copy link
Collaborator

This introduces lazy and cheaply guarded proxy-conversions.

It adds ObjectProxies which extends `AccessibleProxy

We have an easy conversion from ObjectRef to AccessibleProxy

AccessibleProxy::get_interfaces gives insight into which interfaces are unokenebted by the object.

ObjectProxies::proxies returns Proxies, a struct that can contain zero or more proxies to the objects supported interfaces.

The proxies are created only when needed and the check against the InterfaceSet is a cheap bitwise operation.

// Provided by `ObjectRefExt`
let accessible = obj.as_accessible_proxy();

// Provided by `ObjectProxies` extending `AccessibleProxy`
// Aqcuiring `Proxies` needs to be async to get supported interfaces.
let proxies = accessible.proxies().await?;

{
    let action = proxies.action()?; // init and return &mut `ActionProxy`
    let text = proxies.text()?;
}

let action = proxies.action()?; // already initialized! Return   

This introduces lazy and cheaply guarded proxy-conversions.

It adds `ObjectProxies` which extends `AccessibleProxy

We have an easy conversion from `ObjectRef` to `AccessibleProxy`

`AccessibleProxy::get_interfaces` gives insight into which interfaces are
unokenebted by the object.

`ObjectProxies::proxies` returns `Proxies`, a struct that can contain zero or
more proxies to the objects supported interfaces.

The proxies are created only when needed and the check against the `InterfaceSet`
is a cheap bitwise operation.
Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 0% with 143 lines in your changes missing coverage. Please review.

Project coverage is 83.46%. Comparing base (e8fa63c) to head (efbff96).
Report is 6 commits behind head on main.

Files Patch % Lines
atspi-proxies/src/related_proxies.rs 0.00% 141 Missing ⚠️
atspi-common/src/error.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #202      +/-   ##
==========================================
- Coverage   87.22%   83.46%   -3.77%     
==========================================
  Files          40       41       +1     
  Lines        3508     3665     +157     
==========================================
- Hits         3060     3059       -1     
- Misses        448      606     +158     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant