Vendor dependencies

This commit is contained in:
2026-08-01 16:11:49 +03:00
parent 7f139a0241
commit 6b5e7f0f8b
29706 changed files with 9575646 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"22cfa4b0051e2ac911de08874e825f7469a902005f1d142acd0669c63e9929c6","Cargo.toml":"2151eb97bb16221cde6bc612bdae2ec4e2115757a5c78b09ff7aa135762039ac","Cargo.toml.orig":"62c7a00d9f0f6b3d1b80adc06118b2e525e46d220551ba27c7a20d4f6fb873e1","LICENSE":"3fad7aceefeb41cadc5981a99f03a8e226e7318f2db879ff9207405c74e0fb92","README.md":"d710a7a5365780c73fa19c585ad90a7a78d0ea2f244597318544e7b563e59173","src/auto_future.rs":"7d7fdb2c196784797491ddd8d8aaf254e74348ba305a950a42be7a128bb37ca8","src/lib.rs":"4bbfe979c4a96198365833dccbcf0ee13da69ed850050d2896abcacaadbfd8e5"},"package":"3c1e7e457ea78e524f48639f551fd79703ac3f2237f5ecccdf4708f8a75ad373"}
+6
View File
@@ -0,0 +1,6 @@
{
"git": {
"sha1": "5058e171cd6c1f9077e385a32b263e81c1f2a806"
},
"path_in_vcs": ""
}
+29
View File
@@ -0,0 +1,29 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2021"
name = "auto-future"
version = "1.0.0"
authors = ["Joseph Lenton <josephlenton@gmail.com>"]
description = "For quickly making a struct into a future via an async fn"
documentation = "https://docs.rs/auto-future/latest/auto-future"
readme = "README.md"
keywords = [
"async",
"future",
"futures",
]
categories = ["asynchronous"]
license = "MIT"
repository = "https://github.com/JosephLenton/auto-future"
[dependencies]
+14
View File
@@ -0,0 +1,14 @@
[package]
name = "auto-future"
authors = ["Joseph Lenton <josephlenton@gmail.com>"]
description = "For quickly making a struct into a future via an async fn"
version = "1.0.0"
edition = "2021"
license = "MIT"
keywords = ["async", "future", "futures"]
categories = ["asynchronous"]
repository = "https://github.com/JosephLenton/auto-future"
documentation = "https://docs.rs/auto-future/latest/auto-future"
readme = "README.md"
[dependencies]
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Joseph Lenton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+37
View File
@@ -0,0 +1,37 @@
<div align="center">
<h1>
Auto Future<br>
a means for easily building futurable structs
</h1>
[![crate](https://img.shields.io/crates/v/auto-future.svg)](https://crates.io/crates/auto-future)
[![docs](https://docs.rs/auto-future/badge.svg)](https://docs.rs/auto-future)
</div>
This is for quickly making structs futurable, where the future implementation is an underlying `async fn`.
See this example for details ...
```rust
use ::auto_future::AutoFuture;
struct ExampleStruct;
impl ExampleStruct {
async fn do_async_work(self) -> u32 {
// perform a bunch of awaited calls ...
123
}
}
impl IntoFuture for ExampleStruct {
type Output = u32;
type IntoFuture = AutoFuture<u32>;
fn into_future(self) -> Self::IntoFuture {
let raw_future = self.do_async_work();
AutoFuture::new(raw_future)
}
}
```
+53
View File
@@ -0,0 +1,53 @@
use ::std::fmt::Debug;
use ::std::fmt::Formatter;
use ::std::fmt::Result as FmtResult;
use ::std::future::Future;
use ::std::pin::Pin;
use ::std::task::Context;
use ::std::task::Poll;
pub struct AutoFuture<T> {
inner: Pin<Box<dyn Future<Output = T>>>,
is_done: bool,
}
impl<T> AutoFuture<T> {
pub fn new<F>(raw_future: F) -> Self
where
F: Future<Output = T> + 'static,
{
Self {
inner: Box::pin(raw_future),
is_done: false,
}
}
}
impl<T> Future for AutoFuture<T> {
type Output = T;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
if self.is_done {
panic!("Polling future when this is already completed");
}
let inner_poll = self.inner.as_mut().poll(cx);
match inner_poll {
Poll::Pending => Poll::Pending,
Poll::Ready(inner_result) => {
self.is_done = true;
Poll::Ready(inner_result)
}
}
}
}
impl<T> Debug for AutoFuture<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
write!(
f,
"AutoFuture {{ inner: Pin<Box<dyn Future<Output = T>>>, is_dome: {:?} }}",
self.is_done
)
}
}
+2
View File
@@ -0,0 +1,2 @@
mod auto_future;
pub use self::auto_future::*;