-
Notifications
You must be signed in to change notification settings - Fork 115
Feature: Add Bolt12 Uniffi Type Wrappers #542
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
Changes from all commits
07b5471
ef81e0d
dc6a8f2
f01d021
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // This file is Copyright its original authors, visible in version control history. | ||
| // | ||
| // This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
| // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or | ||
| // http://opensource.org/licenses/MIT>, at your option. You may not use this file except in | ||
|
|
||
| #[cfg(feature = "uniffi")] | ||
| mod types; | ||
|
|
||
| #[cfg(feature = "uniffi")] | ||
| pub use types::*; | ||
|
|
||
| #[cfg(feature = "uniffi")] | ||
| pub fn maybe_deref<T, R>(wrapped_type: &std::sync::Arc<T>) -> &R | ||
| where | ||
| T: AsRef<R>, | ||
| { | ||
| wrapped_type.as_ref().as_ref() | ||
| } | ||
|
|
||
| #[cfg(feature = "uniffi")] | ||
| pub fn maybe_try_convert_enum<T, R>(wrapped_type: &T) -> Result<R, crate::error::Error> | ||
| where | ||
| for<'a> R: TryFrom<&'a T, Error = crate::error::Error>, | ||
| { | ||
| R::try_from(wrapped_type) | ||
| } | ||
|
|
||
| #[cfg(feature = "uniffi")] | ||
| pub fn maybe_wrap<T>(ldk_type: impl Into<T>) -> std::sync::Arc<T> { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question! For example, we pass LDK native types (like |
||
| std::sync::Arc::new(ldk_type.into()) | ||
| } | ||
|
|
||
| #[cfg(not(feature = "uniffi"))] | ||
| pub fn maybe_deref<T>(value: &T) -> &T { | ||
| value | ||
| } | ||
|
|
||
| #[cfg(not(feature = "uniffi"))] | ||
| pub fn maybe_try_convert_enum<T>(value: &T) -> Result<&T, crate::error::Error> { | ||
| Ok(value) | ||
| } | ||
|
|
||
| #[cfg(not(feature = "uniffi"))] | ||
| pub fn maybe_wrap<T>(value: T) -> T { | ||
| value | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.