Rename Annotation trait to Annotate

This commit is contained in:
2025-06-30 15:20:40 +10:00
parent 5c257b0f74
commit 99aa11e903
6 changed files with 71 additions and 71 deletions

View File

@@ -67,7 +67,7 @@ impl lb_fslib {
///
/// # Errors
///
/// This function may throw if the file does not exist or cannot be read.
/// This function may throw if the file does not exist or could not be read.
pub async extern "Lua-C" fn read(path: &str) -> Result<Vec<u8>> {
Ok(tokio::fs::read(path).await?)
}
@@ -78,7 +78,7 @@ impl lb_fslib {
///
/// # Errors
///
/// This function may throw if the file does not exist or cannot be read.
/// This function may throw if the file does not exist or could not be read.
pub extern "Lua-C" fn read_sync(path: &str) -> Result<Vec<u8>> {
Ok(std::fs::read(path)?)
}
@@ -87,7 +87,7 @@ impl lb_fslib {
///
/// # Errors
///
/// This function may throw if the file cannot be written.
/// This function may throw if the file could not be written.
pub async extern "Lua-C" fn write(path: &str, contents: &[u8]) -> Result<()> {
Ok(tokio::fs::write(path, contents).await?)
}
@@ -98,7 +98,7 @@ impl lb_fslib {
///
/// # Errors
///
/// This function may throw if the file cannot be written.
/// This function may throw if the file could not be written.
pub extern "Lua-C" fn write_sync(path: &str, contents: &[u8]) -> Result<()> {
Ok(std::fs::write(path, contents)?)
}
@@ -107,7 +107,7 @@ impl lb_fslib {
///
/// # Errors
///
/// This function may throw if the directory cannot be read.
/// This function may throw if the directory could not be read.
pub async extern "Lua-C" fn read_dir(path: &str) -> Result<lb_read_dir> {
Ok(lb_read_dir::new(tokio::fs::read_dir(path).await?))
}
@@ -118,7 +118,7 @@ impl lb_fslib {
///
/// # Errors
///
/// This function may throw if the directory cannot be read.
/// This function may throw if the directory could not be read.
pub extern "Lua-C" fn read_dir_sync(path: &str) -> Result<lb_read_dir_sync> {
Ok(lb_read_dir_sync::new(std::fs::read_dir(path)?))
}
@@ -156,7 +156,7 @@ impl lb_fslib {
///
/// # Errors
///
/// This function may throw if the temporary directory cannot be created.
/// This function may throw if the temporary directory could not be created.
pub extern "Lua-C" fn temp_dir() -> Result<lb_temp_dir> {
Ok(lb_temp_dir::new(tempfile::tempdir()?))
}
@@ -165,7 +165,7 @@ impl lb_fslib {
///
/// # Errors
///
/// This function may throw if the temporary directory cannot be created.
/// This function may throw if the temporary directory could not be created.
pub extern "Lua-C" fn temp_dir_in(path: &str) -> Result<lb_temp_dir> {
Ok(lb_temp_dir::new(tempfile::tempdir_in(path)?))
}
@@ -186,7 +186,7 @@ impl lb_read_dir {
///
/// # Errors
///
/// This function may throw if the directory cannot be read.
/// This function may throw if the directory could not be read.
#[call]
pub async extern "Lua-C" fn next(&self) -> Result<Option<lb_dir_entry>> {
Ok(self
@@ -213,7 +213,7 @@ impl lb_read_dir_sync {
///
/// # Errors
///
/// This function may throw if the directory cannot be read.
/// This function may throw if the directory could not be read.
#[call]
pub extern "Lua-C" fn next(&self) -> Result<Option<lb_dir_entry_sync>> {
Ok(self
@@ -250,7 +250,7 @@ impl lb_dir_entry {
///
/// # Errors
///
/// This function may throw if the file type cannot be determined.
/// This function may throw if the file type could not be determined.
pub async extern "Lua-C" fn r#type(&self) -> Result<lb_file_type> {
Ok(lb_file_type::new(self.0.file_type().await?))
}
@@ -259,7 +259,7 @@ impl lb_dir_entry {
///
/// # Errors
///
/// This function may throw if the metadata cannot be retrieved.
/// This function may throw if the metadata could not be retrieved.
pub async extern "Lua-C" fn metadata(&self) -> Result<lb_file_meta> {
Ok(lb_file_meta::new(self.0.metadata().await?))
}
@@ -302,7 +302,7 @@ impl lb_dir_entry_sync {
///
/// # Errors
///
/// This function may throw if the file type cannot be determined.
/// This function may throw if the file type could not be determined.
pub extern "Lua-C" fn r#type(&self) -> Result<lb_file_type> {
Ok(lb_file_type::new(self.0.file_type()?))
}
@@ -311,7 +311,7 @@ impl lb_dir_entry_sync {
///
/// # Errors
///
/// This function may throw if the metadata cannot be retrieved.
/// This function may throw if the metadata could not be retrieved.
pub extern "Lua-C" fn metadata(&self) -> Result<lb_file_meta> {
Ok(lb_file_meta::new(self.0.metadata()?))
}
@@ -418,7 +418,7 @@ impl lb_file_meta {
///
/// # Errors
///
/// This function may throw if the creation time cannot be retrieved.
/// This function may throw if the creation time could not be retrieved.
pub extern "Lua-C" fn created(&self) -> Result<f64> {
Ok(self
.0
@@ -432,7 +432,7 @@ impl lb_file_meta {
///
/// # Errors
///
/// This function may throw if the modification time cannot be retrieved.
/// This function may throw if the modification time could not be retrieved.
pub extern "Lua-C" fn modified(&self) -> Result<f64> {
Ok(self
.0
@@ -446,7 +446,7 @@ impl lb_file_meta {
///
/// # Errors
///
/// This function may throw if the access time cannot be retrieved.
/// This function may throw if the access time could not be retrieved.
pub extern "Lua-C" fn accessed(&self) -> Result<f64> {
Ok(self
.0
@@ -509,7 +509,7 @@ impl lb_walk_dir {
///
/// # Errors
///
/// This function may throw if the directory cannot be read.
/// This function may throw if the directory could not be read.
#[call]
pub extern "Lua-C" fn next(&self) -> Result<Option<lb_walk_dir_entry>> {
Ok(self
@@ -551,7 +551,7 @@ impl lb_walk_dir_entry {
///
/// # Errors
///
/// This function may throw if the metadata cannot be retrieved.
/// This function may throw if the metadata could not be retrieved.
pub extern "Lua-C" fn metadata(&self) -> Result<lb_file_meta> {
Ok(lb_file_meta::new(self.0.metadata()?))
}
@@ -606,7 +606,7 @@ impl lb_glob_dir {
///
/// # Errors
///
/// This function may throw if the directory cannot be read.
/// This function may throw if the directory could not be read.
#[call]
pub extern "Lua-C" fn next(&self) -> Result<Option<lb_walk_dir_entry>> {
while let Some(res) = self.iter.try_borrow_mut()?.next() {

View File

@@ -510,12 +510,12 @@ pub struct lb_socketaddr(#[opaque] SocketAddr);
#[metatype]
impl lb_socketaddr {
/// Returns the IP part of this address.
/// The IP part of this address.
pub extern "Lua-C" fn ip(&self) -> lb_ipaddr {
self.0.ip().into()
}
/// Returns the port part of this address.
/// The port part of this address.
pub extern "Lua-C" fn port(&self) -> u16 {
self.0.port()
}
@@ -775,16 +775,16 @@ impl lb_tcpstream {
Ok(self.write.try_borrow_mut()?)
}
/// Gets the remote socket address of this stream.
pub extern "Lua-C" fn peer_addr(&self) -> Result<lb_socketaddr> {
Ok(self.read_half()?.peer_addr()?.into())
}
/// Gets the local socket address of this stream.
/// The local socket address that this stream is bound to.
pub extern "Lua-C" fn local_addr(&self) -> Result<lb_socketaddr> {
Ok(self.read_half()?.local_addr()?.into())
}
/// The remote socket address that this stream is connected to.
pub extern "Lua-C" fn peer_addr(&self) -> Result<lb_socketaddr> {
Ok(self.read_half()?.peer_addr()?.into())
}
/// Waits for this stream to be ready in the given half.
///
/// The argument `half` can be `"read"` for the readable half, `"write"` for the writable half,
@@ -936,7 +936,7 @@ impl lb_tcplistener {
}
}
/// Returns the local socket address that this listener is bound to.
/// The local socket address that this listener is bound to.
pub extern "Lua-C" fn local_addr(&self) -> Result<lb_socketaddr> {
Ok(self.listener.local_addr()?.into())
}
@@ -1019,12 +1019,12 @@ impl lb_tcplistener_stream {
}
}
/// Returns the local socket address that the listener is bound to.
/// The local socket address that the listener is bound to.
pub extern "Lua-C" fn local_addr(&self) -> Result<lb_socketaddr> {
Ok(self.stream()?.local_addr()?.into())
}
/// Returns the remote socket address of this stream.
/// The remote socket address that this stream is connected to.
pub extern "Lua-C" fn peer_addr(&self) -> Result<lb_socketaddr> {
Ok(self.stream()?.peer_addr()?.into())
}