Skip to content

Commit 78978eb

Browse files
authored
Add type alias for concurrent FluentBundle (#311)
1 parent f51e309 commit 78978eb

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

fluent-bundle/src/concurrent.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,31 @@ use intl_memoizer::{concurrent::IntlLangMemoizer, Memoizable};
22
use rustc_hash::FxHashMap;
33
use unic_langid::LanguageIdentifier;
44

5-
use crate::bundle::FluentBundle;
65
use crate::memoizer::MemoizerKind;
76
use crate::types::FluentType;
87

9-
impl<R> FluentBundle<R, IntlLangMemoizer> {
8+
/// Specialized [`FluentBundle`](crate::bundle::FluentBundle) over
9+
/// concurrent [`IntlLangMemoizer`](intl_memoizer::concurrent::IntlLangMemoizer).
10+
///
11+
/// A concurrent `FluentBundle` can be constructed with the
12+
/// [`FluentBundle::new_concurrent`] method.
13+
///
14+
/// See [`FluentBundle`](crate::FluentBundle) for the non-concurrent specialization.
15+
pub type FluentBundle<R> = crate::bundle::FluentBundle<R, IntlLangMemoizer>;
16+
17+
impl<R> FluentBundle<R> {
1018
/// A constructor analogous to [`FluentBundle::new`] but operating
1119
/// on a concurrent version of [`IntlLangMemoizer`] over [`Mutex`](std::sync::Mutex).
1220
///
1321
/// # Example
1422
///
1523
/// ```
16-
/// use fluent_bundle::bundle::FluentBundle;
24+
/// use fluent_bundle::concurrent::FluentBundle;
1725
/// use fluent_bundle::FluentResource;
1826
/// use unic_langid::langid;
1927
///
2028
/// let langid_en = langid!("en-US");
21-
/// let mut bundle: FluentBundle<FluentResource, _> =
29+
/// let mut bundle: FluentBundle<FluentResource> =
2230
/// FluentBundle::new_concurrent(vec![langid_en]);
2331
/// ```
2432
pub fn new_concurrent(locales: Vec<LanguageIdentifier>) -> Self {

fluent-bundle/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
//! matures and higher level APIs are being developed.
101101
mod args;
102102
pub mod bundle;
103-
mod concurrent;
103+
pub mod concurrent;
104104
mod entry;
105105
mod errors;
106106
#[doc(hidden)]
@@ -117,8 +117,8 @@ pub use args::FluentArgs;
117117
///
118118
/// This is the basic variant of the [`FluentBundle`](crate::bundle::FluentBundle).
119119
///
120-
/// The concurrent specialization, can be constructed with
121-
/// [`FluentBundle::new_concurrent`](crate::bundle::FluentBundle::new_concurrent).
120+
/// The concurrent specialization can be constructed with
121+
/// [`FluentBundle::new_concurrent`](crate::concurrent::FluentBundle::new_concurrent).
122122
pub type FluentBundle<R> = bundle::FluentBundle<R, intl_memoizer::IntlLangMemoizer>;
123123
pub use errors::FluentError;
124124
pub use message::{FluentAttribute, FluentMessage};

0 commit comments

Comments
 (0)