icu: Make Stringprep private and add helper functions

This makes the API easier to use.
This commit is contained in:
Emmanuel Gil Peyrot 2022-09-20 19:13:44 +02:00
commit 4bfd85556d
2 changed files with 35 additions and 22 deletions

View file

@ -11,7 +11,7 @@ use crate::Strict;
use std::ptr::null_mut;
/// Struct representing a given stringprep profile.
pub struct Stringprep {
pub(crate) struct Stringprep {
inner: *mut UStringPrepProfile,
}
@ -30,7 +30,7 @@ impl Stringprep {
///
/// # Panics
/// Panics if ICU doesnt return a valid UTF-16 string, which should never happen.
pub fn stringprep(&self, input: &str, strict: Strict) -> Result<String, Error> {
pub(crate) fn stringprep(&self, input: &str, strict: Strict) -> Result<String, Error> {
if input.len() > 1023 {
return Err(Error::TooLong);
}