Trait protobuf_native::compiler::SourceTree
source · pub trait SourceTree: Sealed {
// Provided method
fn open<'a>(
self: Pin<&'a mut Self>,
filename: &Path,
) -> Result<Pin<Box<DynZeroCopyInputStream<'a>>>, FileOpenError> { ... }
}
Expand description
Abstract interface which represents a directory tree containing .proto files.
Used by the default implementation of Importer
to resolve import
statements. Most users will probably want to use the DiskSourceTree
implementation.
This trait is sealed and cannot be implemented outside of this crate.
Provided Methods§
sourcefn open<'a>(
self: Pin<&'a mut Self>,
filename: &Path,
) -> Result<Pin<Box<DynZeroCopyInputStream<'a>>>, FileOpenError>
fn open<'a>( self: Pin<&'a mut Self>, filename: &Path, ) -> Result<Pin<Box<DynZeroCopyInputStream<'a>>>, FileOpenError>
Opens the given file and return a stream that reads it.
The filename must be a path relative to the root of the source tree and must not contain “.” or “..” components.