るりまサーチ

最速Rubyリファレンスマニュアル検索!
26件ヒット [1-26件を表示] (0.113秒)
トップページ > クエリ:i[x] > クエリ:end[x] > クエリ:union[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. ipaddr to_i
  5. kernel $-i

ライブラリ

モジュール

キーワード

検索結果

Fiddle::Importer#union(signature) -> Class (24219.0)

C の共用体型に対応する Ruby のクラスを構築して返します。

...Fiddle::Importer#struct と
ほぼ同様です。C における
typedef union epoll_data
{
void *ptr;
i
nt fd;
uint32_t u32;
uint64_t u64;
} epoll_data_t;
は、Ruby上では
require 'fiddle/import'

module M
extend Fiddle::Importer
dlload "libc.so.6"
typealia...
...s("uint32_t", "unsigned int")
typealias("uint64_t", "unsigned long long")

EPollData = union(["void *ptr",
"int fd",
"uint32_t u32",
"uint64_t u64",
])
end

となります。

返されるクラス...
...は Fiddle::CUnion を継承しています。

1.9.x ではこのメソッドで返されるクラスは正しく動作しません。
2.0以降では修正されています。

@param signature 共用体の各要素を文字列で表現したものの配列...

Fiddle::Importer#sizeof(t) -> Integer (6112.0)

C における sizeof(t) の値を返します。

...C における sizeof(t) の値を返します。

t が文字列の場合、その文字列が表す C の型の size が返されます。
例えば、sizeof("char") は 1 を返します。
sizeof("char*") は環境によって 4 や 8 といった値を返します。

Fiddle::Importer#struct...
...イズを返します。
Fiddle::Importer#union で定義した共用体クラスも同様です。

t がクラスの場合、t が to_ptr というインスタンスメソッドを持っている
ならば t.size を返します。

それ以外の場合は Pointer[t].size を返します。

@par...
...対象
@raise Fiddle::DLError t として文字列を渡し、それが表している型を Fiddle が知らなかった
場合に発生します

例:

require 'fiddle/import'

module M
extend Fiddle::Importer
Timeval = struct(["long tv_sec", "long tv_usec"])
p sizeof("cha...

NEWS for Ruby 3.0.0 (60.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting...
...tion warning
# 3.0 => a=>1}, {}]
//}

* Arguments forwarding (`...`) now supports leading arguments.
16378

//emlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end

//}

* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern matching is redesig...
...* GC-ing JIT-ed code is executed in a background thread.
* Reduce the number of locks between Ruby and JIT threads.

== Static analysis

=== RBS

* RBS is a new language for type definition of Ruby programs. It allows writing types of classes and modules with advanced types including union typ...