[−][src]Crate watchman_client
This crate provides a client to the watchman file watching service.
Start with the Connector struct and use it to connect and return a Client struct, Client::resolve_root to resolve a path and initiate a watch, and then Client::query to perform a query.
This example shows how to connect and expand a glob from the current working directory:
use watchman_client::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = Connector::new().connect().await?;
let resolved = client
.resolve_root(CanonicalPath::canonicalize(".")?)
.await?;
// Basic globs -> names
let files = client.glob(&resolved, &["**/*.rs"]).await?;
println!("files: {:#?}", files);
Ok(())
}
Macros
query_result_type | A macro to help define a type to hold file information from a query. This macro enables a type-safe way to define the set of fields to be returned and de-serialize only those fields. |
Structs
CTimeAsFloatField | The field corresponding to the |
CTimeField | The field corresponding to the |
CanonicalPath | Represents a canonical path in the filesystem. |
Client | A live connection to a watchman server. Use Connector to establish a connection. |
ClockRequest | The |
ClockRequestParams | |
ClockResponse | The |
ClockSpec | The fundamental clock specifier string. The contents of the string should be considered to be opaque to the client as the server occasionally evolves the meaning of the clockspec and its format is expressly not a stable API. |
Connector | The Connector defines how to connect to the watchman server.
You will typically use |
ContentSha1HexField | The field corresponding to the |
CreatedClockField | The field corresponding to the |
DeviceNumberField | The field corresponding to the |
DirNameTerm | Match on the parent directory structure https://facebook.github.io/watchman/docs/expr/dirname.html |
ExistsField | The field corresponding to the |
FatClockData | Holds extended clock data that includes source control aware query metadata. https://facebook.github.io/watchman/docs/scm-query.html |
FileTypeField | The field corresponding to the |
GetSockNameResponse | The |
InodeNumberField | The field corresponding to the |
MTimeAsFloatField | The field corresponding to the |
MTimeField | The field corresponding to the |
MatchTerm | Encodes the match expression term https://facebook.github.io/watchman/docs/expr/match.html |
ModeAndPermissionsField | The field corresponding to the |
NameField | The field corresponding to the |
NameOnly | Use the |
NameTerm | Performs an exact match against the file name. https://facebook.github.io/watchman/docs/expr/name.html |
NewField | Deprecated The field corresponding to the |
NumberOfLinksField | The field corresponding to the |
ObservedClockField | The field corresponding to the |
OwnerGidField | The field corresponding to the |
OwnerUidField | The field corresponding to the |
PcreTerm | Use PCRE to match the filename. Note that this is an optional server feature and using this term on a server that doesn't support this feature will generate an error in response to the query. https://facebook.github.io/watchman/docs/expr/pcre.html |
QueryRequest | The |
QueryRequestCommon | The query parameters. There are a large number of fields that influence the behavior. |
QueryResult | Holds the result of a query.
The result is generic over a |
ResolvedRoot | Data that describes a watched filesystem location. Watchman performs watch aggregation to project boundaries, so a request to watch a subdirectory will resolve to the higher level root path and a relative path offset. This struct encodes both pieces of information. |
SavedStateClockData | Holds extended clock data that includes source control aware query metadata. https://facebook.github.io/watchman/docs/scm-query.html |
ScmAwareClockData | Holds extended clock data that includes source control aware query metadata. https://facebook.github.io/watchman/docs/scm-query.html |
SizeField | The field corresponding to the |
SymlinkTargetField | The field corresponding to the |
WatchProjectRequest | The |
WatchProjectResponse | The |
Enums
Clock | A |
ContentSha1Hex | Reports the content SHA1 hash for a file. Since computing the hash can fail, this struct can also represent the error that happened during hash computation. |
Error | |
Expr | An expression term used to filter candidate files from query results. |
FileType | Encodes the file type field returned in query results and specified in expression terms. |
PathGeneratorElement | When using the |
RelOp | Specifies a relational comparison with an integer value |
SinceTerm | Evaluates as true if the specified time property of the file is greater than the since value. https://facebook.github.io/watchman/docs/expr/since.html |