mod configure;
mod validate;
use di::ServiceCollection;
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
pub struct Builder<'a, T: 'static> {
name: String,
services: &'a mut ServiceCollection,
_type: PhantomData<T>,
}
impl<'a, T: 'static> Builder<'a, T> {
#[inline]
pub fn new(services: &'a mut ServiceCollection, name: &str) -> Self {
Self {
name: name.into(),
services,
_type: PhantomData,
}
}
#[inline]
pub fn name(&self) -> &str {
&self.name
}
#[inline]
pub fn services(&mut self) -> &mut ServiceCollection {
self.services
}
}
impl<'a, T> From<Builder<'a, T>> for &'a mut ServiceCollection {
#[inline]
fn from(builder: Builder<'a, T>) -> Self {
builder.services
}
}
impl<'a, T> Deref for Builder<'a, T> {
type Target = ServiceCollection;
#[inline]
fn deref(&self) -> &Self::Target {
self.services
}
}
impl<'a, T> DerefMut for Builder<'a, T> {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
self.services
}
}
fn names_equal(name: &str, other_name: &str) -> bool {
name.len() == other_name.len() && name.eq_ignore_ascii_case(other_name)
}