use std::cell::{Ref, RefMut};
use crate::{borrow_mut_guard::BorrowMutGuard, path_ext::PathExt, Path};
pub trait PathExtGuaranteed: PathExt {
fn borrow(&self) -> Ref<'_, <Self as Path>::Out> {
self.borrow_opt().unwrap()
}
fn borrow_mut(&self) -> BorrowMutGuard<'_, Self> {
self.borrow_opt_mut().unwrap()
}
fn borrow_mut_without_notifying(&self) -> RefMut<'_, <Self as Path>::Out> {
self.borrow_opt_mut_without_notifying().unwrap()
}
fn get(&self) -> Self::Out
where
Self::Out: Clone,
{
self.borrow().clone()
}
fn set(&self, data: Self::Out)
where
Self::Out: Sized,
{
*self.borrow_mut() = data;
}
}