Import Statement在 Protocol Buffers Version 2 Language Specification 中有以下文本:
import = "import" [ "weak" | “public”] strLit ";"
但是Importing Definitions在 Protocol Buffers Version 2 Language Guide 中只谈到了 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.
关于protocol-buffers - Protocol Buffers Version 2 中的 "import weak"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33933397/