hao 0.0.18

Read, edit, create and write .net assemblies
Documentation
//! The well-known type namespace table: one row per .NET namespace, mapping it
//! to the primary [`WellKnownModule`] its types live in and the sub-enum that
//! lists those types. `well_known_namespaces!` (in `macros.rs`) expands this
//! into [`WellKnown`] and each sub-enum's `from_type_name`/`name`/[`TypeName`]
//! impls. The sub-enums themselves are defined in `mod.rs`.

use std::borrow::Cow;

use super::*;

fn strip_arity(name: &'static str) -> &'static str {
    name.split('`').next().unwrap_or(name)
}

// Each namespace names the well-known assembly it primarily lives in (see
// `WellKnown::module()`). Namespaces whose types span assemblies (e.g. `System`,
// where `Console` is in `System.Console`) point at their primary/corlib facade.
well_known_namespaces! {
    "System" in SystemRuntime => System(SystemType),
    "System.Runtime.CompilerServices" in SystemRuntime => SystemRuntimeCompilerServices(SystemRuntimeCompilerServicesType),
    "System.Collections.Generic" in SystemCollections => SystemCollectionsGeneric(SystemCollectionsGenericType),
    "System.Collections" in SystemCollections => SystemCollections(SystemCollectionsType),
    "System.Collections.ObjectModel" in SystemObjectModel => SystemCollectionsObjectModel(SystemCollectionsObjectModelType),
    "System.Collections.Specialized" in SystemCollections => SystemCollectionsSpecialized(SystemCollectionsSpecializedType),
    "System.Reflection" in SystemRuntime => SystemReflection(SystemReflectionType),
    "System.Diagnostics" in SystemRuntime => SystemDiagnostics(SystemDiagnosticsType),
    "System.Runtime.ExceptionServices" in SystemRuntime => SystemRuntimeExceptionServices(SystemRuntimeExceptionServicesType),
    "System.Runtime.InteropServices" in SystemRuntimeInteropServices => SystemRuntimeInteropServices(SystemRuntimeInteropServicesType),
    "System.Threading.Tasks" in SystemThreadingTasks => SystemThreadingTasks(SystemThreadingTasksType),
    "System.Threading" in SystemThreading => SystemThreading(SystemThreadingType),
    "Microsoft.CSharp.RuntimeBinder" in MicrosoftCSharp => MicrosoftCSharpRuntimeBinder(MicrosoftCSharpRuntimeBinderType),
    "Microsoft.VisualBasic" in MicrosoftVisualBasic => MicrosoftVisualBasic(MicrosoftVisualBasicType),
    "Microsoft.VisualBasic.CompilerServices" in MicrosoftVisualBasic => MicrosoftVisualBasicCompilerServices(MicrosoftVisualBasicCompilerServicesType),
    "Microsoft.VisualBasic.ApplicationServices" in MicrosoftVisualBasic => MicrosoftVisualBasicApplicationServices(MicrosoftVisualBasicApplicationServicesType),
    "System.Runtime.InteropServices.WindowsRuntime" in SystemRuntimeInteropServices => SystemRuntimeInteropServicesWindowsRuntime(SystemRuntimeInteropServicesWindowsRuntimeType),
    "Windows.Foundation" in SystemRuntime => WindowsFoundation(WindowsFoundationType),
    "System.ComponentModel" in SystemComponentModelPrimitives => SystemComponentModel(SystemComponentModelType),
    "System.Linq" in SystemLinq => SystemLinq(SystemLinqType),
    "System.Linq.Expressions" in SystemLinqExpressions => SystemLinqExpressions(SystemLinqExpressionsType),
    "System.Xml.Linq" in SystemXmlLinq => SystemXmlLinq(SystemXmlLinqType),
    "System.Security" in SystemRuntime => SystemSecurity(SystemSecurityType),
    "System.Security.Permissions" in SystemRuntime => SystemSecurityPermissions(SystemSecurityPermissionsType),
    "System.Windows.Forms" in SystemWindowsForms => SystemWindowsForms(SystemWindowsFormsType),
    "System.Runtime" in SystemRuntime => SystemRuntime(SystemRuntimeType),
    "System.Text" in SystemRuntime => SystemText(SystemTextType),
    "System.Threading.Tasks.Sources" in SystemThreadingTasks => SystemThreadingTasksSources(SystemThreadingTasksSourcesType),
    "System.IO" in SystemRuntime => SystemIo(SystemIoType),
    "System.Globalization" in SystemRuntime => SystemGlobalization(SystemGlobalizationType),
}