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

@ -4,11 +4,13 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};
use core::time::Duration;
use std::borrow::Cow;
use alloc::borrow::Cow;
use core::{
future::Future,
pin::Pin,
task::{Context, Poll},
time::Duration,
};
use std::io;
use futures::{ready, Sink, SinkExt, Stream, StreamExt};

View file

@ -114,7 +114,7 @@ struct LogXsoBuf<'x>(&'x [u8]);
impl<'x> fmt::Display for LogXsoBuf<'x> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// We always generate UTF-8, so this should be good... I think.
let text = std::str::from_utf8(&self.0).unwrap();
let text = core::str::from_utf8(&self.0).unwrap();
#[cfg(feature = "syntax-highlighting")]
let text = highlight_xml(text);
f.write_str(&text)
@ -195,7 +195,7 @@ impl fmt::Display for ReadError {
}
impl core::error::Error for ReadError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
ReadError::HardError(e) => Some(e),
ReadError::ParseError(e) => Some(e),

View file

@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use std::time::Duration;
use core::time::Duration;
use futures::{SinkExt, StreamExt};