You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As more feature requirements and improvement suggestions arise, the need to allow releases on partially supported features also increments.
An example could be the feature request on #7, which aims to provide a MAC addresses field for the NetworkInterface struct.
So far, support for macOS is on the works, but as such feature is not even in a development phase for other platforms (being Linux and Windows), the release could be delayed to avoid breaking struct definitions in other platforms if the API remains the same.
To solve such issue, a pattern that allows to provide feature support on different platforms without affecting API definitions on the NetworkInterface struct could help.
The approach would require the use of a trait that may be implemented (or not) based on some platform.
Whenever a trait is implemented on all supported platforms, a major release could be published normalizing such field as part of the stable struct definition and deprecating the trait.
Example Usage
use network_interface::{NetworkInterface,NetworkInterfaceConfig,MacAddress};fnmain(){// Show comes as part of the `NetworkInterfaceConfig` trait which is supported by// all target platforms. At this point, such method could be moved to the `NetworkInterface`// struct, deprecating the `NetworkInterfaceConfig` trait.let netifas = NetworkInterface::show();let any_netifa = netifa.get("en0").unwrap();// The method _mac_address_ is provided by the `MacAddress` `trait` which may// not be available for certain platforms at some point in time.//// For instance, such trait could be implemented for Linux but not for macOS nor// Windows.let en0_mac_address = any_netifa.mac_address();}
This approach could limit a bit usage on multi-platform solutions, but will allow users to consume the crate for certain needs while full support is provided.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
As more feature requirements and improvement suggestions arise, the need to allow releases on partially supported features also increments.
An example could be the feature request on #7, which aims to provide a MAC addresses field for the
NetworkInterface
struct.So far, support for macOS is on the works, but as such feature is not even in a development phase for other platforms (being Linux and Windows), the release could be delayed to avoid breaking
struct
definitions in other platforms if the API remains the same.To solve such issue, a pattern that allows to provide feature support on different platforms without affecting API definitions on the
NetworkInterface
struct could help.The approach would require the use of a
trait
that may be implemented (or not) based on some platform.Whenever a
trait
is implemented on all supported platforms, a major release could be published normalizing such field as part of the stable struct definition and deprecating thetrait
.Example Usage
This approach could limit a bit usage on multi-platform solutions, but will allow users to consume the crate for certain needs while full support is provided.
Beta Was this translation helpful? Give feedback.
All reactions