mirror of
https://github.com/AmbiML/sparrow-kata-full.git
synced 2025-08-29 18:13:36 +00:00
39 lines
1.3 KiB
Plaintext
39 lines
1.3 KiB
Plaintext
/*
|
|
* CAmkES backing for Rust Read and Write traits.
|
|
*
|
|
* Copyright 2021, Google LLC
|
|
* Apache License 2.0
|
|
*
|
|
* These CAmkES interfaces express the standard Rust read() and write()
|
|
* signatures, assuming two separate, externally defined, and implicitly
|
|
* associated dataports for each of read and write.
|
|
*
|
|
* It is intended that Rust code be able to use extern "C" declarations
|
|
* referencing the camkes.h that this will generate as the core of
|
|
* implementations of the Read and Write traits.
|
|
*/
|
|
|
|
procedure rust_read_inf {
|
|
// Reads up to limit bytes into the read dataport.
|
|
//
|
|
// Returns the number of bytes read or a negative value if there is any
|
|
// error.
|
|
int read(in size_t limit);
|
|
};
|
|
|
|
procedure rust_write_inf {
|
|
// Writes up to a given number of bytes from the write dataport.
|
|
//
|
|
// Returns the number of bytes actually written or a negative value if there
|
|
// is any error. For non-negative return values < available, the caller is
|
|
// reponsible for retrying with the remaining bytes at the beginning of the
|
|
// write dataport.
|
|
int write(in size_t available);
|
|
|
|
// Blocks until all bytes so far written have been pushed to the real sink.
|
|
//
|
|
// The semantics are the same as Rust's Write::flush. Returns 0 on success
|
|
// and a negative value if there is any error.
|
|
int flush();
|
|
}
|