Skip to content

Commit

Permalink
Merge pull request #294 from c410-f3r/misc
Browse files Browse the repository at this point in the history
wtx-0.26.0
  • Loading branch information
c410-f3r authored Dec 23, 2024
2 parents ba5e9c7 + 40f5393 commit d173d40
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wtx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ name = "wtx"
readme = "README.md"
repository = "https://github.com/c410-f3r/wtx"
rust-version = "1.83"
version = "0.25.0"
version = "0.26.0"

[package.metadata.docs.rs]
all-features = true
5 changes: 4 additions & 1 deletion wtx/src/client_api_framework/network/transport/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ where
{
let response = self.pop_response()?;
pkgs_aux.byte_buffer.clear();
pkgs_aux.byte_buffer.extend_from_copyable_slice(response.lease()).map_err(Into::into)?;
pkgs_aux
.byte_buffer
.extend_from_copyable_slice(response.as_ref().lease())
.map_err(Into::into)?;
Ok(0..pkgs_aux.byte_buffer.len())
}
}
Expand Down
2 changes: 1 addition & 1 deletion wtx/src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub use role::Role;
pub use single_type_storage::SingleTypeStorage;
pub use stream::{BytesStream, Stream, StreamReader, StreamWithTls, StreamWriter};
pub use sync::*;
pub use uri::{Uri, UriArrayString, UriRef, UriString};
pub use uri::{Uri, UriArrayString, UriCow, UriRef, UriString};
pub use usize::Usize;
pub use utf8_errors::{BasicUtf8Error, ExtUtf8Error, StdUtf8Error};
pub use vector::{Vector, VectorError};
Expand Down
10 changes: 10 additions & 0 deletions wtx/src/misc/lease.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ impl LeaseMut<[u8]> for () {
}
}

impl<T> Lease<T> for alloc::borrow::Cow<'_, T>
where
T: alloc::borrow::ToOwned + ?Sized,
{
#[inline]
fn lease(&self) -> &T {
self.as_ref()
}
}

impl<T> Lease<Option<T>> for Option<T> {
#[inline]
fn lease(&self) -> &Option<T> {
Expand Down
2 changes: 2 additions & 0 deletions wtx/src/misc/uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use core::fmt::{Arguments, Debug, Display, Formatter, Write as _};

/// [Uri] with an owned array.
pub type UriArrayString<const N: usize> = Uri<ArrayString<N>>;
/// [Uri] with an owned string.
pub type UriCow<'uri> = Uri<alloc::borrow::Cow<'uri, str>>;
/// [Uri] with a string reference.
pub type UriRef<'uri> = Uri<&'uri str>;
/// [Uri] with an owned string.
Expand Down

0 comments on commit d173d40

Please sign in to comment.