Skip to content

Commit

Permalink
fix no default feature errors
Browse files Browse the repository at this point in the history
  • Loading branch information
starkat99 committed Oct 12, 2021
1 parent 790fbf9 commit 525e1b0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl<'a> Iterator for Utf16Chars<'a> {
impl<'a> FusedIterator for Utf16Chars<'a> {}

impl<'a> core::fmt::Debug for Utf16Chars<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
crate::debug_fmt_utf16_iter(self.clone(), f)
}
}
Expand Down Expand Up @@ -191,7 +191,7 @@ impl<'a> Iterator for Utf32Chars<'a> {
impl<'a> FusedIterator for Utf32Chars<'a> {}

impl<'a> core::fmt::Debug for Utf32Chars<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
crate::debug_fmt_utf32_iter(self.clone(), f)
}
}
Expand Down Expand Up @@ -268,7 +268,7 @@ impl<'a> Iterator for CharsLossy<'a> {
impl<'a> FusedIterator for CharsLossy<'a> {}

impl<'a> core::fmt::Debug for CharsLossy<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_char('"')?;
for c in self.clone() {
f.write_char(c)?;
Expand Down
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,15 @@ use core::{char::DecodeUtf16Error, fmt::Write};
pub mod error;
pub mod iter;
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
mod platform;
pub mod ucstr;
#[cfg(feature = "alloc")]
#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
pub mod ucstring;
pub mod ustr;
#[cfg(feature = "alloc")]
#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
pub mod ustring;

#[doc(no_inline)]
Expand All @@ -228,9 +231,11 @@ pub mod ustring;
pub use error::{ContainsNul, FromUtf32Error, MissingNulError, MissingNulTerminator, NulError};
pub use ucstr::{U16CStr, U32CStr, UCStr, WideCStr};
#[cfg(feature = "alloc")]
#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
pub use ucstring::{U16CString, U32CString, UCString, WideCString};
pub use ustr::{U16Str, U32Str, UStr, WideStr};
#[cfg(feature = "alloc")]
#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
pub use ustring::{U16String, U32String, UString, WideString};

/// Marker trait for primitive types used to represent wide character data. Should not be used
Expand Down Expand Up @@ -434,16 +439,19 @@ fn debug_fmt_utf32_iter(
fmt.write_char('"')
}

#[cfg(feature = "alloc")]
#[inline(always)]
fn is_utf16_surrogate(u: u16) -> bool {
(0xD800..=0xDFFF).contains(&u)
}

#[cfg(feature = "alloc")]
#[inline(always)]
fn is_utf16_high_surrogate(u: u16) -> bool {
(0xD800..=0xDBFF).contains(&u)
}

#[cfg(feature = "alloc")]
#[inline(always)]
fn is_utf16_low_surrogate(u: u16) -> bool {
(0xDC00..=0xDFFF).contains(&u)
Expand Down
2 changes: 1 addition & 1 deletion src/ucstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ impl<C: UChar> PartialEq<crate::UStr<C>> for UCStr<C> {

impl<C: UChar> PartialOrd<crate::UStr<C>> for UCStr<C> {
#[inline]
fn partial_cmp(&self, other: &crate::UStr<C>) -> Option<std::cmp::Ordering> {
fn partial_cmp(&self, other: &crate::UStr<C>) -> Option<core::cmp::Ordering> {
self.as_ustr().partial_cmp(other)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ustr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ impl<C: UChar> PartialEq<crate::UCStr<C>> for UStr<C> {

impl<C: UChar> PartialOrd<crate::UCStr<C>> for UStr<C> {
#[inline]
fn partial_cmp(&self, other: &crate::UCStr<C>) -> Option<std::cmp::Ordering> {
fn partial_cmp(&self, other: &crate::UCStr<C>) -> Option<core::cmp::Ordering> {
self.partial_cmp(other.as_ustr())
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/ustring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1384,13 +1384,13 @@ impl<C: UChar> ToOwned for UStr<C> {

impl Write for U16String {
#[inline]
fn write_str(&mut self, s: &str) -> std::fmt::Result {
fn write_str(&mut self, s: &str) -> core::fmt::Result {
self.push_str(s);
Ok(())
}

#[inline]
fn write_char(&mut self, c: char) -> std::fmt::Result {
fn write_char(&mut self, c: char) -> core::fmt::Result {
self.push_char(c);
Ok(())
}
Expand Down

0 comments on commit 525e1b0

Please sign in to comment.