/*
 * call-seq:
 *   struct.to_s      => string
 *   struct.inspect   => string
 *
 * Describe the contents of this struct in a string.
 */

static VALUE
rb_struct_inspect(s)
    VALUE s;
{
    if (rb_inspecting_p(s)) {
        char *cname = rb_class2name(rb_obj_class(s));
        size_t len = strlen(cname) + 14;
        VALUE str = rb_str_new(0, len);

        snprintf(RSTRING(str)->ptr, len+1, "#<struct %s:...>", cname);
        RSTRING(str)->len = strlen(RSTRING(str)->ptr);
        return str;
    }
    return rb_protect_inspect(inspect_struct, s, 0);
}