Note that the "use" operator for traits (inside a class) and the "use" operator for namespaces (outside the class)

Note that the "use" operator for traits (inside a class) and the "use" operator for namespaces (outside the class) resolve names differently. "use" for namespaces always sees its arguments as absolute (starting at the global namespace):




On the other hand, "use" for traits respects the current namespace:






Together with "use" for closures, there are now three different "use" operators. They all mean different things and behave differently.

你可能感兴趣的:(Note that the "use" operator for traits (inside a class) and the "use" operator for namespaces (outside the class))