tokio_xmpp: Replace std stuff with alloc/core stuff

This commit is contained in:
xmppftw xmppftw 2024-12-19 19:34:10 +01:00 committed by Emmanuel Gil Peyrot
commit 1ce2f894aa
12 changed files with 27 additions and 28 deletions

View file

@ -1,3 +1,4 @@
use core::{fmt, net::SocketAddr};
#[cfg(feature = "dns")]
use futures::{future::select_ok, FutureExt};
#[cfg(feature = "dns")]
@ -6,7 +7,6 @@ use hickory_resolver::{
};
#[cfg(feature = "dns")]
use log::debug;
use std::net::SocketAddr;
use tokio::net::TcpStream;
use crate::Error;
@ -43,8 +43,8 @@ pub enum DnsConfig {
},
}
impl std::fmt::Display for DnsConfig {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl fmt::Display for DnsConfig {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
#[cfg(feature = "dns")]
Self::UseSrv { host, .. } => write!(f, "{}", host),

View file

@ -25,7 +25,7 @@ pub trait AsyncReadAndWrite: AsyncBufRead + AsyncWrite + Unpin + Send {}
impl<T: AsyncBufRead + AsyncWrite + Unpin + Send> AsyncReadAndWrite for T {}
/// Trait that must be extended by the implementation of ServerConnector
pub trait ServerConnectorError: std::error::Error + Sync + Send {}
pub trait ServerConnectorError: core::error::Error + Sync + Send {}
/// Trait called to connect to an XMPP server, perhaps called multiple times
pub trait ServerConnector: Clone + core::fmt::Debug + Send + Unpin + 'static {
@ -37,7 +37,7 @@ pub trait ServerConnector: Clone + core::fmt::Debug + Send + Unpin + 'static {
jid: &Jid,
ns: &'static str,
timeouts: Timeouts,
) -> impl std::future::Future<
) -> impl core::future::Future<
Output = Result<(PendingFeaturesRecv<Self::Stream>, ChannelBinding), Error>,
> + Send;
}

View file

@ -1,10 +1,9 @@
//! `starttls::ServerConfig` provides a `ServerConnector` for starttls connections
use alloc::borrow::Cow;
use core::{error::Error as StdError, fmt};
#[cfg(feature = "tls-native")]
use native_tls::Error as TlsError;
use std::borrow::Cow;
use std::error::Error as StdError;
use std::fmt;
use std::io;
use std::os::fd::AsRawFd;
#[cfg(all(feature = "tls-rust", not(feature = "tls-native")))]
@ -16,7 +15,7 @@ use futures::{sink::SinkExt, stream::StreamExt};
#[cfg(all(feature = "tls-rust", not(feature = "tls-native")))]
use {
std::sync::Arc,
alloc::sync::Arc,
tokio_rustls::{
rustls::pki_types::ServerName,
rustls::{ClientConfig, RootCertStore},

View file

@ -1,6 +1,6 @@
//! `starttls::ServerConfig` provides a `ServerConnector` for starttls connections
use std::borrow::Cow;
use alloc::borrow::Cow;
use tokio::{io::BufStream, net::TcpStream};