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 borrowing #24

Merged
merged 4 commits into from Sep 29, 2022
Merged

Add borrowing #24

merged 4 commits into from Sep 29, 2022

Conversation

jerel
Copy link
Owner

@jerel jerel commented Sep 29, 2022

This provides the ability to borrow Dart types from another namespace instead of generating a separate copy into each namespace. Example:

#[async_dart(
  namespace = "orgs",
  borrow = "locations::Location",
  borrow = "accounts::Contact",
  borrow = "accounts::Filter",
  borrow = "accounts::Match",
  borrow = "accounts::Status"
)]
pub async fn get_org_with_borrowed_type(id: data::Filter) -> Result<data::Organization, String> {
  let _ = id;
  Ok(data::Organization {
    id: 1,
    owner: data::Contact::default(),
    location: data::Location {
      polyline_coords: vec![(-104.0185546875, 43.004647127794435)],
    },
  })
}

The borrow format is namespace::Class.

@jerel jerel merged commit 0106809 into main Sep 29, 2022
@jerel jerel deleted the add-borrowing branch September 29, 2022 16:32
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.

None yet

1 participant