use crate::{
options::{ReadConcern, SelectionCriteria, WriteConcern},
Collection as AsyncCollection,
Namespace,
};
#[derive(Clone, Debug)]
pub struct Collection<T>
where
T: Send + Sync,
{
pub(crate) async_collection: AsyncCollection<T>,
}
impl<T> Collection<T>
where
T: Send + Sync,
{
pub(crate) fn new(async_collection: AsyncCollection<T>) -> Self {
Self { async_collection }
}
pub fn clone_with_type<U: Send + Sync>(&self) -> Collection<U> {
Collection::new(self.async_collection.clone_with_type())
}
pub fn name(&self) -> &str {
self.async_collection.name()
}
pub fn namespace(&self) -> Namespace {
self.async_collection.namespace()
}
pub fn selection_criteria(&self) -> Option<&SelectionCriteria> {
self.async_collection.selection_criteria()
}
pub fn read_concern(&self) -> Option<&ReadConcern> {
self.async_collection.read_concern()
}
pub fn write_concern(&self) -> Option<&WriteConcern> {
self.async_collection.write_concern()
}
}