Skip to content

Commit 96cfc9e

Browse files
authored
Rollup merge of #90835 - sunfishcode:sunfishcode/wasi-char-device, r=alexcrichton
Rename WASI's `is_character_device` to `is_char_device`. Rename WASI's `FileTypeExt::is_character_device` to `FileTypeExt::is_char_device`, for consistency with the Unix `FileTypeExt::is_char_device`. Also, add a `FileTypeExt::is_socket` function, for consistency with the Unix `FileTypeExt::is_socket` function. r? `@alexcrichton`
2 parents ed7ed5f + 2d46d1b commit 96cfc9e

File tree

1 file changed

+6
-2
lines changed
  • library/std/src/os/wasi

1 file changed

+6
-2
lines changed

library/std/src/os/wasi/fs.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -444,18 +444,22 @@ pub trait FileTypeExt {
444444
/// Returns `true` if this file type is a block device.
445445
fn is_block_device(&self) -> bool;
446446
/// Returns `true` if this file type is a character device.
447-
fn is_character_device(&self) -> bool;
447+
fn is_char_device(&self) -> bool;
448448
/// Returns `true` if this file type is a socket datagram.
449449
fn is_socket_dgram(&self) -> bool;
450450
/// Returns `true` if this file type is a socket stream.
451451
fn is_socket_stream(&self) -> bool;
452+
/// Returns `true` if this file type is any type of socket.
453+
fn is_socket(&self) -> bool {
454+
self.is_socket_stream() || self.is_socket_dgram()
455+
}
452456
}
453457

454458
impl FileTypeExt for fs::FileType {
455459
fn is_block_device(&self) -> bool {
456460
self.as_inner().bits() == wasi::FILETYPE_BLOCK_DEVICE
457461
}
458-
fn is_character_device(&self) -> bool {
462+
fn is_char_device(&self) -> bool {
459463
self.as_inner().bits() == wasi::FILETYPE_CHARACTER_DEVICE
460464
}
461465
fn is_socket_dgram(&self) -> bool {

0 commit comments

Comments
 (0)