Enum valkyrie_ast::ImportState
source · pub enum ImportState {
Explicit,
Implicit,
Duplicate,
Ambiguous,
}Expand description
The resolve result of import
function,constant,structure,interfaces,typeshare a namespacederiveandmacroshare a namespace- If a macro is an implicit macro, it occupies the namespace of the function
namespace a {
class A;
class B;
class C;
class D;
}
namespace b {
class A;
class B;
class C;
}
using a.*;
using b.*;
using a.{A, B};
using b.B;
§Script Mode
In script mode, adjusting the import statement orders at the same level does not affect the final result.
-
You cannot explicitly import two objects with the same name, it is a compile-time error
-
You cannot implicitly import two objects with the same name, this is a compile-time warning
-
Extensions cannot be implicitly imported
-
A:
a::A (explicit) -
B:
null (duplicate, error, not available) -
C:
null (ambiguous, waring, not available) -
D:
a::D (implicit)
§Interactive Mode
In repl mode, imports always available.
-
later implicit imports will override earlier implicit imports
-
later explicit imports will override earlier explicit imports
-
A:
a::A (explicit) -
B:
b::B (explicit) -
C:
b::C (implicit) -
D:
a::D (implicit)
Variants§
Explicit
Available by explicit import
Implicit
Available by implicit import
Duplicate
Unavailable due to duplicate import
Ambiguous
Unavailable due to ambiguous import
Trait Implementations§
source§impl Clone for ImportState
impl Clone for ImportState
source§fn clone(&self) -> ImportState
fn clone(&self) -> ImportState
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ImportState
impl Debug for ImportState
source§impl Hash for ImportState
impl Hash for ImportState
source§impl PartialEq for ImportState
impl PartialEq for ImportState
source§fn eq(&self, other: &ImportState) -> bool
fn eq(&self, other: &ImportState) -> bool
self and other values to be equal, and is used
by ==.