Make tokio's rt-multi-thread enabled again in examples
This commit is contained in:
parent
6ba0cd03f8
commit
f830671ee9
|
@ -64,7 +64,7 @@ optional = true
|
|||
|
||||
[dependencies.tokio]
|
||||
version = "1.22.0"
|
||||
features = ["macros"]
|
||||
features = ["macros", "io-util", "time"]
|
||||
|
||||
[dependencies.tokio-util]
|
||||
version = "0.7.4"
|
||||
|
@ -91,5 +91,6 @@ all = ["toml", "json", "env"]
|
|||
# default = ["reqwest/default-tls"]
|
||||
default = ["reqwest/default-tls"]
|
||||
env = ["envy"]
|
||||
mt = ["tokio/rt-multi-thread"]
|
||||
json = []
|
||||
rustls-tls = ["reqwest/rustls-tls"]
|
||||
|
|
|
@ -4,8 +4,7 @@ mod register;
|
|||
use mastodon_async::Result;
|
||||
|
||||
#[cfg(feature = "toml")]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
async fn run() -> Result<()> {
|
||||
let mastodon = register::get_mastodon_data().await?;
|
||||
let input = register::read_line("Enter the account id you'd like to follow: ")?;
|
||||
let new_follow = mastodon.follow(input.trim()).await?;
|
||||
|
@ -14,10 +13,22 @@ async fn main() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", feature = "mt"))]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", not(feature = "mt")))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "toml"))]
|
||||
fn main() {
|
||||
println!(
|
||||
"examples require the `toml` feature, run this command for this example:\n\ncargo run \
|
||||
--example follow_profile --features toml\n"
|
||||
--example follow_profile --features toml,mt\n"
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,8 +4,7 @@ mod register;
|
|||
use mastodon_async::Result;
|
||||
|
||||
#[cfg(feature = "toml")]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
async fn run() -> Result<()> {
|
||||
use futures::StreamExt;
|
||||
|
||||
let mastodon = register::get_mastodon_data().await?;
|
||||
|
@ -21,6 +20,18 @@ async fn main() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", feature = "mt"))]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", not(feature = "mt")))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "toml"))]
|
||||
fn main() {
|
||||
println!(
|
||||
|
|
|
@ -4,8 +4,7 @@ mod register;
|
|||
use mastodon_async::Result;
|
||||
|
||||
#[cfg(feature = "toml")]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
async fn run() -> Result<()> {
|
||||
use futures_util::StreamExt;
|
||||
use mastodon_async::StatusesRequest;
|
||||
|
||||
|
@ -23,6 +22,18 @@ async fn main() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", feature = "mt"))]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", not(feature = "mt")))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "toml"))]
|
||||
fn main() {
|
||||
println!(
|
||||
|
|
|
@ -5,8 +5,7 @@ use futures_util::StreamExt;
|
|||
use mastodon_async::Result;
|
||||
|
||||
#[cfg(feature = "toml")]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
async fn run() -> Result<()> {
|
||||
register::get_mastodon_data()
|
||||
.await?
|
||||
.get_home_timeline()
|
||||
|
@ -25,6 +24,18 @@ async fn main() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", feature = "mt"))]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", not(feature = "mt")))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "toml"))]
|
||||
fn main() {
|
||||
println!(
|
||||
|
|
|
@ -7,8 +7,7 @@ use log::{as_serde, info};
|
|||
use mastodon_async::Result;
|
||||
|
||||
#[cfg(feature = "toml")]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
async fn run() -> Result<()> {
|
||||
use log::warn;
|
||||
|
||||
femme::with_level(log::LevelFilter::Info);
|
||||
|
@ -27,6 +26,18 @@ async fn main() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", feature = "mt"))]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", not(feature = "mt")))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "toml"))]
|
||||
fn main() {
|
||||
println!(
|
||||
|
|
|
@ -5,8 +5,7 @@ mod register;
|
|||
use mastodon_async::{Language, Result, StatusBuilder, Visibility};
|
||||
|
||||
#[cfg(feature = "toml")]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
async fn run() -> Result<()> {
|
||||
let mastodon = register::get_mastodon_data().await?;
|
||||
let status = StatusBuilder::new()
|
||||
.status(register::read_line(
|
||||
|
@ -34,6 +33,18 @@ async fn main() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", feature = "mt"))]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", not(feature = "mt")))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "toml"))]
|
||||
fn main() {
|
||||
println!(
|
||||
|
|
|
@ -5,8 +5,7 @@ mod register;
|
|||
use mastodon_async::Result;
|
||||
|
||||
#[cfg(feature = "toml")]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
async fn run() -> Result<()> {
|
||||
let mastodon = register::get_mastodon_data().await?;
|
||||
let you = mastodon.verify_credentials().await?;
|
||||
|
||||
|
@ -15,6 +14,18 @@ async fn main() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", feature = "mt"))]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", not(feature = "mt")))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "toml"))]
|
||||
fn main() {
|
||||
println!(
|
||||
|
|
|
@ -10,13 +10,21 @@ use mastodon_async::helpers::toml;
|
|||
use mastodon_async::{helpers::cli, Result};
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[cfg(feature = "toml")]
|
||||
#[cfg(all(feature = "toml", feature = "mt"))]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
register().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[cfg(all(feature = "toml", not(feature = "mt")))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<()> {
|
||||
register().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[cfg(feature = "toml")]
|
||||
pub async fn get_mastodon_data() -> Result<Mastodon> {
|
||||
|
|
|
@ -5,8 +5,7 @@ mod register;
|
|||
use mastodon_async::Result;
|
||||
|
||||
#[cfg(feature = "toml")]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
async fn run() -> Result<()> {
|
||||
let mastodon = register::get_mastodon_data().await?;
|
||||
let input = register::read_line("Enter the term you'd like to search: ")?;
|
||||
let result = mastodon.search(&input, false).await?;
|
||||
|
@ -16,6 +15,18 @@ async fn main() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", feature = "mt"))]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", not(feature = "mt")))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "toml"))]
|
||||
fn main() {
|
||||
println!(
|
||||
|
|
|
@ -4,8 +4,7 @@ mod register;
|
|||
use mastodon_async::{Result, StatusBuilder, Visibility};
|
||||
|
||||
#[cfg(feature = "toml")]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
async fn run() -> Result<()> {
|
||||
use register::bool_input;
|
||||
femme::with_level(femme::LevelFilter::Trace);
|
||||
let mastodon = register::get_mastodon_data().await?;
|
||||
|
@ -33,6 +32,18 @@ async fn main() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", feature = "mt"))]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "toml", not(feature = "mt")))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<()> {
|
||||
run().await
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "toml"))]
|
||||
fn main() {
|
||||
println!(
|
||||
|
|
Loading…
Reference in New Issue