-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lxc::Container::get_ips() design improvement #12
Comments
I made the PR but I didn’t try it: #14 |
It’s work fine:
|
The only issue remaining is the |
There is many |
Until panics are reduced to a minimum, the only crate I can currently use is |
The
lxc::Container::get_ips()
API encapsulates theget_ips()
oflxc_sys::lxc_container
.There are multiples issues with the design of
lxc::Container::get_ips()
:Vec<String>
instead ofVec<std::net::IpAddr>
. IP addresses are rarely used simply as strings. They're often parsed before becoming useful.interfaces: &str
:get_ips()
gets aninterface: *const c_char
. Using the plural form "interfaces" is misleading.get_ips()
can acceptNULL
as the value for this parameter, which has its own semantics in the implementation ofget_ips()
inliblxc
.family: &str
: the rawget_ips()
can acceptNULL
as the value for this parameter, which has its own semantics in the implementation ofget_ips()
inliblxc
.scope: i32
, but the rawget_ips()
gets ascope: c_int
. Assuming that a Cint
maps always toi32
is a bad idea, and is not always true.Given all these points, I suggest changing the prototype of
lxc::Container::get_ips()
to the following:The text was updated successfully, but these errors were encountered: