rusty_hello 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f4126cf82c418020607b3abc89ed3e2aaa5f5b0af44c8705f7efb5b505594134
4
+ data.tar.gz: 145c68932a38d4f1f3d6281d02bbe28659f132308036ce0029ac0112ed6fa7c0
5
+ SHA512:
6
+ metadata.gz: 915e0ab5d72035e511a1174c90ef53dccdf9400af0ac824917ba8eb933f447c6ad444b4ce7bcfff7c7240d98a7f4ec5d891b9473054d1313ca24f119914e71ef
7
+ data.tar.gz: 8574290ccda66beb085262ee7f812bc4384e8ca8ff438c80e06b963035583bcfc4f5ef1819923b8f9f055c10cbc5673d6cb0c7d38bd8a231f76a1adf17928c25
@@ -0,0 +1,12 @@
1
+ [package]
2
+ name = "rusty_hello"
3
+ version = "0.1.0"
4
+ authors = ["Leszek Zalewski <leszekzalewski@fastmail.fm>"]
5
+ edition = "2018"
6
+
7
+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
+
9
+ [dependencies]
10
+
11
+ [lib]
12
+ crate-type = ["cdylib"]
@@ -0,0 +1,35 @@
1
+ # RustyHello
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rusty_hello`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'rusty_hello'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rusty_hello
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rusty_hello.
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rusty_hello/version"
4
+ require_relative "rusty_hello/ffi"
5
+
6
+ module RustyHello
7
+
8
+ class Error < StandardError; end
9
+
10
+ def self.[](n)
11
+ FFI.fib(n)
12
+ end
13
+
14
+ end
@@ -0,0 +1,21 @@
1
+ require 'ffi'
2
+
3
+ module RustyHello
4
+
5
+ module FFI
6
+
7
+ extend ::FFI::Library
8
+
9
+ lib_name =
10
+ case ::FFI::Platform::LIBSUFFIX
11
+ when "so", "dylib" then "librusty_hello"
12
+ when "dll" then "rusty_hello"
13
+ end
14
+
15
+ ffi_lib File.expand_path("#{lib_name}.#{::FFI::Platform::LIBSUFFIX}", __dir__)
16
+
17
+ attach_function :fib, [:uint], :uint
18
+
19
+ end
20
+ end
21
+
@@ -0,0 +1 @@
1
+ /home/runner/work/rusty_hello/rusty_hello/target/x86_64-unknown-linux-gnu/release/librusty_hello.so: /home/runner/work/rusty_hello/rusty_hello/src/lib.rs
@@ -0,0 +1 @@
1
+ D:\a\rusty_hello\rusty_hello\target\x86_64-pc-windows-msvc\release\rusty_hello.dll: D:\a\rusty_hello\rusty_hello\src\lib.rs
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RustyHello
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/rusty_hello/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "rusty_hello"
7
+ spec.version = RustyHello::VERSION
8
+ spec.authors = ["Leszek Zalewski"]
9
+ spec.email = ["leszekzalewski@fastmail.fm"]
10
+
11
+ spec.summary = "Write a short summary, because RubyGems requires one."
12
+ spec.description = "Write a longer description or delete this line."
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
16
+
17
+ spec.files = Dir["lib/**/*", "src/**/*.rs", "rusty_hello.gemspec", "Cargo.toml", "LICENSE", "README.md"]
18
+
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "ffi"
22
+
23
+ end
@@ -0,0 +1,8 @@
1
+ #[no_mangle]
2
+ pub extern fn fib(n: u32) -> u32 {
3
+ if n <= 1 {
4
+ n
5
+ } else {
6
+ fib(n - 1) + fib(n - 2)
7
+ }
8
+ }
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rusty_hello
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Leszek Zalewski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-12-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Write a longer description or delete this line.
28
+ email:
29
+ - leszekzalewski@fastmail.fm
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - Cargo.toml
35
+ - README.md
36
+ - lib/rusty_hello.rb
37
+ - lib/rusty_hello/ffi.rb
38
+ - lib/rusty_hello/librusty_hello.d
39
+ - lib/rusty_hello/librusty_hello.dylib
40
+ - lib/rusty_hello/librusty_hello.so
41
+ - lib/rusty_hello/rusty_hello.d
42
+ - lib/rusty_hello/rusty_hello.dll
43
+ - lib/rusty_hello/rusty_hello.dll.exp
44
+ - lib/rusty_hello/rusty_hello.dll.lib
45
+ - lib/rusty_hello/rusty_hello.pdb
46
+ - lib/rusty_hello/version.rb
47
+ - rusty_hello.gemspec
48
+ - src/lib.rs
49
+ homepage:
50
+ licenses: []
51
+ metadata:
52
+ allowed_push_host: https://rubygems.org
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 2.3.0
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubygems_version: 3.1.2
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: Write a short summary, because RubyGems requires one.
72
+ test_files: []