code for chapter12 pd added

This commit is contained in:
peshwar9 2020-12-07 10:09:44 +05:30
parent c12faec2b5
commit 62e9b4b475
72 changed files with 48 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"config":{"output_file":null,"full_docs":false,"pub_only":false,"reachable_only":false,"distro_crate":false,"signatures":false,"borrow_data":false},"version":"0.19.0","compilation":{"directory":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp","program":"/Users/prabhueshwarla/.rustup/toolchains/stable-x86_64-apple-darwin/bin/rls","arguments":[],"output":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/target/rls/debug/deps/libtcpudp-97cca98b69045fb9.rmeta"},"prelude":{"crate_id":{"name":"tcpudp","disambiguator":[14252695875775721232,9879066391318841997]},"crate_root":"src","external_crates":[{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":1,"id":{"name":"std","disambiguator":[9054049529852543209,5756799355281213394]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":2,"id":{"name":"core","disambiguator":[649336883146201894,3308516238322163950]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":3,"id":{"name":"compiler_builtins","disambiguator":[1154582834482060450,16344204990542480537]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":4,"id":{"name":"rustc_std_workspace_core","disambiguator":[9212379515936652129,17808485286264063370]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":5,"id":{"name":"alloc","disambiguator":[13327579764654116281,14306064291630426625]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":6,"id":{"name":"libc","disambiguator":[17773251733480933597,18239998491734583498]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":7,"id":{"name":"unwind","disambiguator":[8567743581675804787,15655200220621371766]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":8,"id":{"name":"cfg_if","disambiguator":[15115520782807859583,9813785573872252500]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":9,"id":{"name":"backtrace","disambiguator":[1572943810868196833,3902827232285166711]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":10,"id":{"name":"rustc_demangle","disambiguator":[6290371580101917419,15395902185345451181]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":11,"id":{"name":"backtrace_sys","disambiguator":[2934540361684350378,924291485644145262]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":12,"id":{"name":"hashbrown","disambiguator":[9277678418438935259,15657907931940784437]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":13,"id":{"name":"rustc_std_workspace_alloc","disambiguator":[5423566938548125357,18340948646597872466]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter11/tcpudp/src/main.rs","num":14,"id":{"name":"panic_unwind","disambiguator":[489208416821938960,3305070343783546974]}}],"span":{"file_name":"src/main.rs","byte_start":2,"byte_end":16,"line_start":3,"line_end":5,"column_start":1,"column_end":2}},"imports":[],"defs":[{"kind":"Mod","id":{"krate":0,"index":0},"span":{"file_name":"src/main.rs","byte_start":2,"byte_end":16,"line_start":3,"line_end":5,"column_start":1,"column_end":2},"name":"","qualname":"::","value":"src/main.rs","parent":null,"children":[{"krate":0,"index":1},{"krate":0,"index":2},{"krate":0,"index":3}],"decl_id":null,"docs":"","sig":null,"attributes":[]},{"kind":"Function","id":{"krate":0,"index":3},"span":{"file_name":"src/main.rs","byte_start":5,"byte_end":9,"line_start":3,"line_end":3,"column_start":4,"column_end":8},"name":"main","qualname":"::main","value":"fn () -> ()","parent":null,"children":[],"decl_id":null,"docs":"","sig":null,"attributes":[]}],"impls":[],"refs":[],"macro_refs":[],"relations":[]}

File diff suppressed because one or more lines are too long

5
chapter12/ffi/Cargo.lock generated Normal file
View File

@ -0,0 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "ffi"
version = "0.1.0"

12
chapter12/ffi/Cargo.toml Normal file
View File

@ -0,0 +1,12 @@
[package]
name = "ffi"
version = "0.1.0"
authors = ["peshwar9"]
edition = "2018"
[lib]
name = "ffitest"
crate-type = ["dylib"]
[dependencies]

5
chapter12/ffi/rustffi.c Normal file
View File

@ -0,0 +1,5 @@
#include "rustffi.h"
int main(void)
{
see_ffi_in_action();
}

1
chapter12/ffi/rustffi.h Normal file
View File

@ -0,0 +1 @@
void see_ffi_in_action();

4
chapter12/ffi/src/lib.rs Normal file
View File

@ -0,0 +1,4 @@
#[no_mangle]
pub extern "C" fn see_ffi_in_action() {
println!("Congrats! You have successfully invoked Rust shared library from a C program");
}

View File

@ -0,0 +1 @@
{"rustc_fingerprint":4503571881771466578,"outputs":{"1164083562126845933":["rustc 1.43.0 (4fb7144ed 2020-04-20)\nbinary: rustc\ncommit-hash: 4fb7144ed159f94491249e86d5bbd033b5d60550\ncommit-date: 2020-04-20\nhost: x86_64-apple-darwin\nrelease: 1.43.0\nLLVM version: 9.0\n",""],"4476964694761187371":["___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/prabhueshwarla/.rustup/toolchains/stable-x86_64-apple-darwin\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n",""]},"successes":{}}

View File

@ -0,0 +1 @@
This file has an mtime of when this was started.

View File

@ -0,0 +1 @@
{"rustc":12217307662193597186,"features":"[]","target":229042405531770237,"profile":1647870076477133176,"path":10872709659218687626,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/ffi-19d6d678a2f77aa3/dep-test-lib-ffitest-19d6d678a2f77aa3"}}],"rustflags":[],"metadata":13779719443416291531}

View File

@ -0,0 +1 @@
This file has an mtime of when this was started.

View File

@ -0,0 +1 @@
{"rustc":12217307662193597186,"features":"[]","target":229042405531770237,"profile":14891217944882224483,"path":10872709659218687626,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/ffi-273a3790abc26d1b/dep-lib-ffitest-273a3790abc26d1b"}}],"rustflags":[],"metadata":13779719443416291531}

View File

@ -0,0 +1,5 @@
/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/target/rls/debug/deps/ffitest-19d6d678a2f77aa3.rmeta: src/lib.rs
/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/target/rls/debug/deps/ffitest-19d6d678a2f77aa3.d: src/lib.rs
src/lib.rs:

View File

@ -0,0 +1,5 @@
/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/target/rls/debug/deps/ffitest-273a3790abc26d1b.rmeta: src/lib.rs
/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/target/rls/debug/deps/ffitest-273a3790abc26d1b.d: src/lib.rs
src/lib.rs:

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"config":{"output_file":null,"full_docs":false,"pub_only":false,"reachable_only":false,"distro_crate":false,"signatures":false,"borrow_data":false},"version":"0.19.0","compilation":{"directory":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi","program":"/Users/prabhueshwarla/.rustup/toolchains/stable-x86_64-apple-darwin/bin/rls","arguments":[],"output":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/target/rls/debug/deps/libffitest-273a3790abc26d1b.rmeta"},"prelude":{"crate_id":{"name":"ffitest","disambiguator":[6784396376749770646,6914394608390877879]},"crate_root":"src","external_crates":[{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":1,"id":{"name":"std","disambiguator":[9054049529852543209,5756799355281213394]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":2,"id":{"name":"core","disambiguator":[649336883146201894,3308516238322163950]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":3,"id":{"name":"compiler_builtins","disambiguator":[1154582834482060450,16344204990542480537]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":4,"id":{"name":"rustc_std_workspace_core","disambiguator":[9212379515936652129,17808485286264063370]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":5,"id":{"name":"alloc","disambiguator":[13327579764654116281,14306064291630426625]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":6,"id":{"name":"libc","disambiguator":[17773251733480933597,18239998491734583498]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":7,"id":{"name":"unwind","disambiguator":[8567743581675804787,15655200220621371766]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":8,"id":{"name":"cfg_if","disambiguator":[15115520782807859583,9813785573872252500]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":9,"id":{"name":"backtrace","disambiguator":[1572943810868196833,3902827232285166711]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":10,"id":{"name":"rustc_demangle","disambiguator":[6290371580101917419,15395902185345451181]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":11,"id":{"name":"backtrace_sys","disambiguator":[2934540361684350378,924291485644145262]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":12,"id":{"name":"hashbrown","disambiguator":[9277678418438935259,15657907931940784437]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":13,"id":{"name":"rustc_std_workspace_alloc","disambiguator":[5423566938548125357,18340948646597872466]}},{"file_name":"/Users/prabhueshwarla/rust/author/packt/prod/chapter12/ffi/src/lib.rs","num":14,"id":{"name":"panic_unwind","disambiguator":[489208416821938960,3305070343783546974]}}],"span":{"file_name":"src/lib.rs","byte_start":0,"byte_end":148,"line_start":1,"line_end":4,"column_start":1,"column_end":2}},"imports":[],"defs":[{"kind":"Mod","id":{"krate":0,"index":0},"span":{"file_name":"src/lib.rs","byte_start":0,"byte_end":148,"line_start":1,"line_end":4,"column_start":1,"column_end":2},"name":"","qualname":"::","value":"src/lib.rs","parent":null,"children":[{"krate":0,"index":1},{"krate":0,"index":2},{"krate":0,"index":3}],"decl_id":null,"docs":"","sig":null,"attributes":[]},{"kind":"Function","id":{"krate":0,"index":3},"span":{"file_name":"src/lib.rs","byte_start":31,"byte_end":48,"line_start":2,"line_end":2,"column_start":19,"column_end":36},"name":"see_ffi_in_action","qualname":"::see_ffi_in_action","value":"fn () -> ()","parent":null,"children":[],"decl_id":null,"docs":"","sig":null,"attributes":[{"value":"no_mangle","span":{"file_name":"src/lib.rs","byte_start":0,"byte_end":12,"line_start":1,"line_end":1,"column_start":1,"column_end":13}}]}],"impls":[],"refs":[],"macro_refs":[],"relations":[]}