use super::*;
impl<'a> Source<'a> {
#[inline]
#[must_use]
pub fn new(lang: LANG, code: &'a [u8]) -> Self {
Self {
lang,
code: Cow::Borrowed(code),
name: None,
preproc_path: None,
preproc: None,
}
}
#[inline]
#[must_use]
pub fn from_bytes(lang: LANG, code: Vec<u8>) -> Self {
Self {
lang,
code: Cow::Owned(code),
name: None,
preproc_path: None,
preproc: None,
}
}
#[inline]
#[must_use]
pub fn with_name(mut self, name: Option<String>) -> Self {
self.name = name;
self
}
#[inline]
#[must_use]
pub fn with_preproc_path(mut self, preproc_path: Option<&'a Path>) -> Self {
self.preproc_path = preproc_path;
self
}
#[inline]
#[must_use]
pub fn with_preproc(mut self, preproc: Option<Arc<PreprocResults>>) -> Self {
self.preproc = preproc;
self
}
}