use super::*;
#[allow(non_camel_case_types)]
#[doc(hidden)]
#[derive(Copy, Clone)]
pub struct _private_TypeLayoutDerive {
pub shared_vars: &'static SharedVars,
pub mono: &'static MonoTypeLayout,
pub abi_consts: AbiConsts,
pub data: GenericTLData,
pub tag: Option<&'static Tag>,
pub extra_checks: Option<&'static ManuallyDrop<StoredExtraChecks>>,
}
#[allow(non_camel_case_types)]
#[doc(hidden)]
#[derive(Copy, Clone)]
pub struct _private_MonoTypeLayoutDerive {
pub name: RStr<'static>,
pub item_info: ItemInfo,
pub data: MonoTLData,
pub generics: CompGenericParams,
pub repr_attr: ReprAttr,
pub mod_refl_mode: ModReflMode,
pub phantom_fields: RSlice<'static, CompTLFieldRepr>,
pub shared_vars: MonoSharedVars,
}
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, StableAbi)]
#[sabi(unsafe_sabi_opaque_fields)]
pub struct ItemInfo {
package_and_version: RStr<'static>,
pub line: u32,
pub mod_path: ModPath,
}
impl ItemInfo {
#[doc(hidden)]
pub const fn new(package_and_version: &'static str, line: u32, mod_path: ModPath) -> Self {
Self {
package_and_version: RStr::from_str(package_and_version),
line,
mod_path,
}
}
pub const fn primitive() -> Self {
Self {
package_and_version: RStr::from_str("std;1.0.0"),
line: 0,
mod_path: ModPath::PRELUDE,
}
}
pub const fn std_type_in(mod_path: NulStr<'static>) -> Self {
Self {
package_and_version: RStr::from_str("std;1.0.0"),
line: 0,
mod_path: ModPath::inside(mod_path),
}
}
pub const fn package_and_mod(
package_and_version: &'static str,
mod_path: NulStr<'static>,
) -> Self {
Self {
package_and_version: RStr::from_str(package_and_version),
line: 0,
mod_path: ModPath::inside(mod_path),
}
}
pub fn package_and_version(&self) -> (&'static str, &'static str) {
let pav = self.package_and_version.as_str();
match pav.find(';') {
Some(separator) => (&pav[..separator], &pav[(separator + 1)..]),
None => (pav, ""),
}
}
pub fn package(&self) -> &'static str {
self.package_and_version().0
}
pub fn version(&self) -> &'static str {
self.package_and_version().1
}
}