Adjusting the repository position.
This commit is contained in:
parent
cdc3be4832
commit
ae902d1508
@ -4,7 +4,7 @@ version = "0.1.0"
|
||||
authors = ["Jason Travis Smith <Myrddin@CyberMagesLLC.com>"]
|
||||
description = "Defines macros and functions used when binding to C libraries."
|
||||
license = ""
|
||||
repository = "https://gitlab.com/CyberMages/binding.git"
|
||||
repository = "https://gitlab.com/CyberMages/Core/binding.git"
|
||||
documentation = ""
|
||||
keywords = ["binding", "c types", "c enums", "c flags", "c strings"]
|
||||
|
||||
@ -15,4 +15,4 @@ use_std = ["scribe/use_std"]
|
||||
|
||||
|
||||
[dependencies.scribe]
|
||||
git = "https://gitlab.com/CyberMages/scribe.git"
|
||||
git = "ssh://git@gitlab.com/CyberMages/Core/scribe.git"
|
||||
|
@ -1,73 +0,0 @@
|
||||
//use std::ffi::{CStr, CString};
|
||||
//use super::c_types::CChar;
|
||||
|
||||
|
||||
|
||||
/// Defines an empty string.
|
||||
pub const EMPTY_STRING: &'static str = "";
|
||||
|
||||
|
||||
|
||||
/*
|
||||
TODO: from_c_string should be moved to wherever our String class will
|
||||
reside.
|
||||
|
||||
/// Creates a new String from the data in the pointer.
|
||||
///
|
||||
/// Any conversion errors will result in an Empty
|
||||
/// String being returned. Option is not used here for
|
||||
/// simplicities sake.
|
||||
pub fn from_c_string(c_string: *const CChar) -> String
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
CStr::from_ptr(c_string).to_string_lossy().into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
TODO: Determine if a CString class can be created at this level if
|
||||
there is no allocation available. The answer is probably not,
|
||||
but it needs to be investigated.
|
||||
|
||||
/// Creates a CString from a given str.
|
||||
///
|
||||
/// This may be "" if there is an UTF8 conversion error.
|
||||
/// If it can not create an empty CString, then it will panic.
|
||||
pub fn to_c_string<P>(string: P) -> CString
|
||||
where P: AsRef<str>
|
||||
{
|
||||
// Try to create a CString from the given str.
|
||||
match CString::new(string.as_ref())
|
||||
{
|
||||
Ok(c_string) =>
|
||||
{
|
||||
// Return the new CString.
|
||||
c_string
|
||||
}
|
||||
|
||||
Err(error) =>
|
||||
{
|
||||
warn!("Unable to create a CString from the given str: {}", error);
|
||||
|
||||
// Try to atleast make an empty CString.
|
||||
match CString::new(EMPTY_STRING)
|
||||
{
|
||||
Ok(c_string) =>
|
||||
{
|
||||
// Return the new CString.
|
||||
c_string
|
||||
}
|
||||
|
||||
Err(final_error) =>
|
||||
{
|
||||
// This is a show stopping error.
|
||||
error!("Unable to create an empty CString: {}", final_error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
@ -22,7 +22,6 @@ extern crate scribe;
|
||||
// Basic C type macro modules.
|
||||
mod c_enum;
|
||||
mod c_flags;
|
||||
mod c_string;
|
||||
mod c_types;
|
||||
|
||||
// Raw platform data retrieval.
|
||||
@ -30,8 +29,6 @@ mod raw;
|
||||
|
||||
|
||||
|
||||
pub use self::c_string::EMPTY_STRING;
|
||||
//pub use self::c_string::{from_c_string, to_c_string};
|
||||
pub use self::c_types::{CChar, CIChar, CUChar};
|
||||
pub use self::c_types::{CShort, CUShort, CInt, CUInt, CLong, CULong};
|
||||
pub use self::c_types::{CLongLong, CULongLong, CFloat, CDouble};
|
||||
|
Loading…
x
Reference in New Issue
Block a user