Protocol Buffers Version 2 中 "import weak" 的含义是什么?
What is meaning of "import weak" in Protocol Buffers Version 2?
Protocol Buffers Version 2 Language Specification 中的 Import Statement 具有以下文本:
import = "import" [ "weak" | “public”] strLit ";"
但是Protocol Buffers Version 2 Language Guide中的Importing Definitions只谈到了public
的使用。 import weak
是什么意思?我用谷歌搜索了答案。但是我找不到解释。
弱导入是可选的依赖项。
有关 EnforceWeakDependencies
的一些详细信息,请参阅文档:
void DescriptorPool::EnforceWeakDependencies(
bool enforce)
By default, weak imports are allowed to be missing, in which case we will use a placeholder for the dependency and convert the field to be an Empty message field.
If you call EnforceWeakDependencies(true), however, the DescriptorPool will report a import not found error.
Import Statement 具有以下文本:
import = "import" [ "weak" | “public”] strLit ";"
但是Protocol Buffers Version 2 Language Guide中的Importing Definitions只谈到了public
的使用。 import weak
是什么意思?我用谷歌搜索了答案。但是我找不到解释。
弱导入是可选的依赖项。
有关 EnforceWeakDependencies
的一些详细信息,请参阅文档:
void DescriptorPool::EnforceWeakDependencies( bool enforce)
By default, weak imports are allowed to be missing, in which case we will use a placeholder for the dependency and convert the field to be an Empty message field.
If you call EnforceWeakDependencies(true), however, the DescriptorPool will report a import not found error.