Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Aug 30, 2024
1 parent 97c7975 commit 9cc6093
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/libs/windows/src/extensions/Foundation/Async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ impl<T: RuntimeType, P: RuntimeType> IntoFuture for IAsyncOperationWithProgress<
//

impl IAsyncAction {
/// Waits for the `IAsyncAction` to finish.
pub fn get(&self) -> Result<()> {
if self.Status()? == AsyncStatus::Started {
let (_waiter, signaler) = Waiter::new()?;
Expand All @@ -252,6 +253,7 @@ impl IAsyncAction {
}

impl<T: RuntimeType> IAsyncOperation<T> {
/// Waits for the `IAsyncOperation<T>` to finish.
pub fn get(&self) -> Result<T> {
if self.Status()? == AsyncStatus::Started {
let (_waiter, signaler) = Waiter::new()?;
Expand All @@ -268,6 +270,7 @@ impl<T: RuntimeType> IAsyncOperation<T> {
}

impl<P: RuntimeType> IAsyncActionWithProgress<P> {
/// Waits for the `IAsyncActionWithProgress<P>` to finish.
pub fn get(&self) -> Result<()> {
if self.Status()? == AsyncStatus::Started {
let (_waiter, signaler) = Waiter::new()?;
Expand All @@ -284,6 +287,7 @@ impl<P: RuntimeType> IAsyncActionWithProgress<P> {
}

impl<T: RuntimeType, P: RuntimeType> IAsyncOperationWithProgress<T, P> {
/// Waits for the `IAsyncOperationWithProgress<T, P>` to finish.
pub fn get(&self) -> Result<T> {
if self.Status()? == AsyncStatus::Started {
let (_waiter, signaler) = Waiter::new()?;
Expand Down
4 changes: 4 additions & 0 deletions crates/libs/windows/src/extensions/Foundation/AsyncReady.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,24 +195,28 @@ impl<T: RuntimeType, P: RuntimeType> IAsyncOperationWithProgress_Impl<T, P> for
}

impl IAsyncAction {
/// Creates an `IAsyncAction` that is immediately ready with a value.
pub fn ready(result: Result<()>) -> Self {
ReadyAction(ReadyState::new(result)).into()
}
}

impl<T: RuntimeType> IAsyncOperation<T> {
/// Creates an `IAsyncOperation<T>` that is immediately ready with a value.
pub fn ready(result: Result<T>) -> Self {
ReadyOperation(ReadyState::new(result)).into()
}
}

impl<P: RuntimeType> IAsyncActionWithProgress<P> {
/// Creates an `IAsyncActionWithProgress<P>` that is immediately ready with a value.
pub fn ready(result: Result<()>) -> Self {
ReadyActionWithProgress(ReadyState::new(result)).into()
}
}

impl<T: RuntimeType, P: RuntimeType> IAsyncOperationWithProgress<T, P> {
/// Creates an `IAsyncOperationWithProgress<T, P>` that is immediately ready with a value.
pub fn ready(result: Result<T>) -> Self {
ReadyOperationWithProgress(ReadyState::new(result)).into()
}
Expand Down
4 changes: 4 additions & 0 deletions crates/libs/windows/src/extensions/Foundation/AsyncSpawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ impl<T: RuntimeType, P: RuntimeType> IAsyncOperationWithProgress_Impl<T, P> for
}

impl IAsyncAction {
/// Creates an `IAsyncAction` that waits for the closure to execute on the Windows thread pool.
pub fn spawn<F>(f: F) -> Self
where
F: FnOnce() -> Result<()> + Send + 'static,
Expand All @@ -261,6 +262,7 @@ impl IAsyncAction {
}

impl<T: RuntimeType> IAsyncOperation<T> {
/// Creates an `IAsyncOperation<T>` that waits for the closure to execute on the Windows thread pool.
pub fn spawn<F>(f: F) -> Self
where
F: FnOnce() -> Result<T> + Send + 'static,
Expand All @@ -277,6 +279,7 @@ impl<T: RuntimeType> IAsyncOperation<T> {
}

impl<P: RuntimeType> IAsyncActionWithProgress<P> {
/// Creates an `IAsyncActionWithProgress<P>` that waits for the closure to execute on the Windows thread pool.
pub fn spawn<F>(f: F) -> Self
where
F: FnOnce() -> Result<()> + Send + 'static,
Expand All @@ -293,6 +296,7 @@ impl<P: RuntimeType> IAsyncActionWithProgress<P> {
}

impl<T: RuntimeType, P: RuntimeType> IAsyncOperationWithProgress<T, P> {
/// Creates an `IAsyncOperationWithProgress<T, P>` that waits for the closure to execute on the Windows thread pool.
pub fn spawn<F>(f: F) -> Self
where
F: FnOnce() -> Result<T> + Send + 'static,
Expand Down

0 comments on commit 9cc6093

Please sign in to comment.