names(Type) may be what you are looking for, e.g. names(Complex) => [:re, 
:im]

On Saturday, 8 March 2014 14:41:47 UTC, Uwe Fechner wrote:
>
> Thanks, iob.data works.
>
> Is there a way in Julia to find out what are the field names of a Type, 
> like the dir function in Python?
>
> Best regards:
>
> Uwe
>
> On Saturday, March 8, 2014 3:33:27 PM UTC+1, Ivar Nesje wrote:
>>
>> Judging from 
>> base/iobuffer.jl<https://github.com/JuliaLang/julia/blob/master/base/iobuffer.jl>,
>>  
>> you can access iob.data to see the actual Uint8 array that backs a 
>> PipeBuffer.
>>
>> Just note that type fields is not considered part of the exported and 
>> (somewhat) stable interface.
>>
>> Ivar
>>
>> kl. 14:34:42 UTC+1 lørdag 8. mars 2014 skrev Uwe Fechner følgende:
>>>
>>> Hello,
>>>
>>> I would like to convert the content of a pipebuffer int an array of 
>>> Uint8.
>>>
>>> My code so far:
>>>
>>>     iob = PipeBuffer();
>>>     write(iob, char(14))
>>>     writeproto(iob, pub.state)
>>>
>>> Now I want to print the content of iob as hex string for debugging.
>>>
>>> I can use bytes2hex to convert an array of Uint8 to a hex string,
>>> like in this example:
>>>
>>> s="Hello world!"
>>> bytes2hex(convert(Array{Uint8, 1}, s))
>>>
>>> but I could not find a way to access the content of a PipeBuffer.
>>>
>>> Any idea?
>>>
>>> Regards:
>>>
>>> Uwe
>>>
>>

Reply via email to